From d7736dd8532acab799b44b8aba5b38703450ba1b Mon Sep 17 00:00:00 2001 From: Xinfeng Liu Date: Mon, 6 Jan 2020 11:12:00 +0800 Subject: [PATCH 1/2] Update travis to use go 1.10.x for fixing CI To fix "go get -u github.com/golang/lint/golint" error. https://github.com/golang/lint/issues/421 Also fix integratinon test when using golang 1.10.x In AddProcessToContainer(), the returned stdout buffer has x00 padded, after it is converted to string, it still has padded zeros. This commit trims the padded zeros in string. Replace "github.com/golang/lint/golint" with "golang.org/x/lint/golint" from below error message: (this is needed for golang 1.12 or later) ``` package github.com/golang/lint/golint: code in directory /home/travis/gopath/src/github.com/golang/lint/golint expects import "golang.org/x/lint/golint" ``` Signed-off-by: Xinfeng Liu --- .travis.yml | 5 ++--- integration-test/exec_test.go | 3 ++- integration-test/start_linux_test.go | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 690b670f65cc2..859da52e001a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,7 @@ sudo: required language: go go: - - 1.8.x - - tip + - 1.10.x go_import_path: github.com/containerd/containerd @@ -23,7 +22,7 @@ env: install: - hack/install-seccomp.sh - hack/install-runc.sh - - go get -u github.com/golang/lint/golint + - go get -u golang.org/x/lint/golint script: - make all diff --git a/integration-test/exec_test.go b/integration-test/exec_test.go index 23021e5e250b8..155b1504fe4c7 100644 --- a/integration-test/exec_test.go +++ b/integration-test/exec_test.go @@ -4,6 +4,7 @@ package main import ( "path/filepath" + "strings" "syscall" "time" @@ -58,7 +59,7 @@ func (cs *ContainerdSuite) TestBusyboxTopExecEcho(t *check.C) { t.Assert(*e, checker.Equals, evt) } - t.Assert(echop.io.stdoutBuffer.String(), checker.Equals, "Ay Caramba!") + t.Assert(strings.TrimRight(echop.io.stdoutBuffer.String(), string('\x00')), checker.Equals, "Ay Caramba!") } func (cs *ContainerdSuite) TestBusyboxTopExecTop(t *check.C) { diff --git a/integration-test/start_linux_test.go b/integration-test/start_linux_test.go index c3f569ea232de..b5377d2470cbd 100644 --- a/integration-test/start_linux_test.go +++ b/integration-test/start_linux_test.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "syscall" "time" @@ -439,7 +440,7 @@ func (cs *ContainerdSuite) TestRestart(t *check.C) { t.Assert(*e, checker.Equals, evt) } - t.Assert(echop.io.stdoutBuffer.String(), checker.Equals, "Success!") + t.Assert(strings.TrimRight(echop.io.stdoutBuffer.String(), string('\x00')), checker.Equals, "Success!") // Now kill daemon (SIGKILL) cs.StopDaemon(true) From 6bab7397aa460c702a50ba53806d967dd7692ec5 Mon Sep 17 00:00:00 2001 From: Xinfeng Liu Date: Tue, 7 Jan 2020 14:33:02 +0800 Subject: [PATCH 2/2] Add go 1.12, 1.13 and tip to Travis CI Also fixed `make test` failure in go 1.12 and 1.13 by removing 'github.com/containerd/containerd/api/http/pprof' from 'go test -bench'. Set parallel to 1 in `make integration-test` Signed-off-by: Xinfeng Liu --- .travis.yml | 3 +++ Makefile | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 859da52e001a3..36069bbafff15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ language: go go: - 1.10.x + - 1.12.x + - 1.13.x + - tip go_import_path: github.com/containerd/containerd diff --git a/Makefile b/Makefile index c822bf762c8c6..45507a79b6af9 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ shell: dbuild $(DOCKER_RUN) bash test: validate install bundles-rootfs - go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test ) -runtime=$(RUNTIME) + go test -bench=. -v $(shell go list ./... | grep -v -e /vendor -e /integration-test -e /pprof) -runtime=$(RUNTIME) ifneq ($(wildcard /.dockerenv), ) cd integration-test ; \ go test -check.v -check.timeout=$(TEST_TIMEOUT) $(TESTFLAGS) timeout=$(TEST_SUITE_TIMEOUT) github.com/containerd/containerd/integration-test @@ -98,10 +98,10 @@ endif integration-test: cd integration-test ; \ -go test -check.v -check.timeout=$(TEST_TIMEOUT) $(TESTFLAGS) timeout=$(TEST_SUITE_TIMEOUT) github.com/containerd/containerd/integration-test +go test -parallel 1 -check.v -check.timeout=$(TEST_TIMEOUT) $(TESTFLAGS) timeout=$(TEST_SUITE_TIMEOUT) github.com/containerd/containerd/integration-test bench: shim validate install bundles-rootfs - go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) -runtime=$(RUNTIME) + go test -bench=. -v $(shell go list ./... | grep -v -e /vendor -e /integration-test -e /pprof) -runtime=$(RUNTIME) validate: fmt lint