Skip to content

Commit

Permalink
Update golangci-lint to 1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dtomcej authored and traefiker committed Oct 9, 2019
1 parent 53c8104 commit 7ebc1a2
Show file tree
Hide file tree
Showing 18 changed files with 205 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ WORKDIR /go/src/github.com/containous/maesh
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh

# Download golangci-lint binary to bin folder in $GOPATH
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.20.0

ENV GO111MODULE on
COPY go.mod go.sum ./
Expand Down
2 changes: 2 additions & 0 deletions cmd/maesh/maesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func main() {
func maeshCommand(iConfig *cmd.MaeshConfiguration) error {
log.SetOutput(os.Stdout)
log.SetLevel(log.InfoLevel)

if iConfig.Debug {
log.SetLevel(log.DebugLevel)
}
Expand All @@ -77,5 +78,6 @@ func maeshCommand(iConfig *cmd.MaeshConfiguration) error {
if err = ctr.Run(stopCh); err != nil {
log.Fatalf("Error running ctr: %v", err)
}

return nil
}
1 change: 1 addition & 0 deletions cmd/prepare/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewCmd(pConfig *cmd.PrepareConfig, loaders []cli.ResourceLoader) *cli.Comma
func patchCommand(pConfig *cmd.PrepareConfig) error {
log.SetOutput(os.Stdout)
log.SetLevel(log.InfoLevel)

if pConfig.Debug {
log.SetLevel(log.DebugLevel)
}
Expand Down
2 changes: 2 additions & 0 deletions integration/coredns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (s *CoreDNSSuite) TestCoreDNSVersion(c *check.C) {
c.Log(test.desc)
s.setCoreDNSVersion(c, test.version)
err := s.installHelmMaesh(c, false, false)

if test.expectedError {
err = s.waitForMaeshControllerStartedWithReturn()
c.Assert(err, checker.NotNil)
Expand All @@ -70,6 +71,7 @@ func (s *CoreDNSSuite) TestCoreDNSVersion(c *check.C) {
s.waitForMaeshControllerStarted(c)
s.waitKubectlExecCommand(c, argSlice, "whoami")
}

s.unInstallHelmMaesh(c)
}
}
5 changes: 4 additions & 1 deletion integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Test(t *testing.T) {

output, err := cmd.CombinedOutput()
fmt.Println(string(output))

if err != nil {
fmt.Printf("unable to pull docker image: %v", err)
}
Expand Down Expand Up @@ -104,6 +105,7 @@ func (s *BaseSuite) startk3s(c *check.C) {

// Load images into k3s
c.Log("Importing docker images in to k3s...")

err = s.loadK3sImages()
c.Assert(err, checker.IsNil)

Expand All @@ -120,6 +122,7 @@ func (s *BaseSuite) startk3s(c *check.C) {
c.Assert(err, checker.IsNil)

s.try = try.NewTry(s.client)

c.Log("k3s start successfully.")
}

Expand All @@ -130,6 +133,7 @@ func (s *BaseSuite) loadK3sImages() error {
return err
}
}

return nil
}

Expand Down Expand Up @@ -281,7 +285,6 @@ func (s *BaseSuite) unInstallHelmMaesh(c *check.C) {

func (s *BaseSuite) setCoreDNSVersion(c *check.C, version string) {
// Get current coreDNS deployment.

deployment, exists, err := s.client.GetDeployment(metav1.NamespaceSystem, "coredns")
c.Assert(err, checker.IsNil)
c.Assert(exists, checker.True)
Expand Down
5 changes: 4 additions & 1 deletion integration/smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (s *SMISuite) TestSMIAccessControl(c *check.C) {
// Pod B -> Service E.maesh /test returns 404
// Pod C -> Service E.maesh /test returns 404
// Pod D -> Service E.maesh /test returns 404

s.createResources(c, "resources/smi")
s.createResources(c, "resources/smi/access-control/")

Expand Down Expand Up @@ -202,6 +201,7 @@ func (s *SMISuite) TestSMIAccessControl(c *check.C) {
argSlice := []string{
"exec", "-it", test.source, "--", "curl", "-v", test.destination + test.path, "--max-time", "5",
}

c.Log(test.desc)
s.waitKubectlExecCommand(c, argSlice, fmt.Sprintf("HTTP/1.1 %d", test.expected))
}
Expand Down Expand Up @@ -363,9 +363,11 @@ func (s *SMISuite) TestSMITrafficSplit(c *check.C) {

time.Sleep(10 * time.Second)
}

argSlice := []string{
"exec", "-it", test.source, "--", "curl", "-v", test.destination, "--max-time", "5",
}

c.Log(test.desc)

err := s.try.WaitFunction(func() error {
Expand Down Expand Up @@ -430,6 +432,7 @@ func (s *SMISuite) deleteResources(c *check.C, dirPath string, force bool) {
if force {
args = append(args, "--force", "--grace-period=0")
}

cmd := exec.Command("kubectl", args...)
cmd.Env = os.Environ()
_, err := cmd.CombinedOutput()
Expand Down
10 changes: 8 additions & 2 deletions integration/try/try.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (t *Try) WaitCommandExecute(command string, argSlice []string, expected str
ebo.MaxElapsedTime = applyCIMultiplier(timeout)

var output []byte

if err := backoff.Retry(safe.OperationWithRecover(func() error {
cmd := exec.Command(command, argSlice...)
cmd.Env = os.Environ()
Expand Down Expand Up @@ -129,6 +130,7 @@ func (t *Try) WaitCommandExecuteReturn(command string, argSlice []string, timeou
ebo.MaxElapsedTime = applyCIMultiplier(timeout)

var output []byte

if err := backoff.Retry(safe.OperationWithRecover(func() error {
cmd := exec.Command(command, argSlice...)
cmd.Env = os.Environ()
Expand Down Expand Up @@ -185,8 +187,11 @@ func (t *Try) WaitClientCreated(url string, kubeConfigPath string, timeout time.
ebo := backoff.NewExponentialBackOff()
ebo.MaxElapsedTime = applyCIMultiplier(timeout)

var clients *k8s.ClientWrapper
var err error
var (
clients *k8s.ClientWrapper
err error
)

if err = backoff.Retry(safe.OperationWithRecover(func() error {
clients, err = k8s.NewClientWrapper(url, kubeConfigPath)
if err != nil {
Expand All @@ -212,6 +217,7 @@ func applyCIMultiplier(timeout time.Duration) time.Duration {

ciTimeoutMultiplier := getCITimeoutMultiplier()
log.Debug("Apply CI multiplier:", ciTimeoutMultiplier)

return time.Duration(float64(timeout) * ciTimeoutMultiplier)
}

Expand Down
Loading

0 comments on commit 7ebc1a2

Please sign in to comment.