diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f8303d9a..eea258566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,6 +205,11 @@ jobs: git checkout "${SHIM_COMMIT}" GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1 + - name: Tests + env: + CGO_ENABLED: 1 + run: mingw32-make.exe test root-test + - name: Integration 1 env: CGO_ENABLED: 1 @@ -282,6 +287,15 @@ jobs: sudo make install working-directory: src/github.com/containerd/containerd + - name: Tests + env: + GOPROXY: direct + SKIPTESTS: github.com/containerd/containerd/snapshots/devmapper + run: | + make test + sudo -E PATH=$PATH GOPATH=$GOPATH GOPROXY=$GOPROXY make root-test + working-directory: src/github.com/containerd/containerd + - name: Integration 1 env: GOPROXY: direct diff --git a/snapshots/overlay/overlay_test.go b/snapshots/overlay/overlay_test.go index 7671b83dc..77eed8530 100644 --- a/snapshots/overlay/overlay_test.go +++ b/snapshots/overlay/overlay_test.go @@ -174,6 +174,7 @@ func testOverlayOverlayMount(t *testing.T, newSnapshotter testsuite.SnapshotterF lower = "lowerdir=" + getParents(ctx, o, root, "/tmp/layer2")[0] ) for i, v := range []string{ + "index=off", work, upper, lower, @@ -334,12 +335,12 @@ func testOverlayView(t *testing.T, newSnapshotter testsuite.SnapshotterFunc) { if m.Source != "overlay" { t.Errorf("mount source should be overlay but received %q", m.Source) } - if len(m.Options) != 1 { - t.Errorf("expected 1 mount option but got %d", len(m.Options)) + if len(m.Options) != 2 { + t.Errorf("expected 1 additional mount option but got %d", len(m.Options)) } lowers := getParents(ctx, o, root, "/tmp/view2") expected = fmt.Sprintf("lowerdir=%s:%s", lowers[0], lowers[1]) - if m.Options[0] != expected { + if m.Options[1] != expected { t.Errorf("expected option %q but received %q", expected, m.Options[0]) } } diff --git a/snapshots/testsuite/testsuite.go b/snapshots/testsuite/testsuite.go index b2434025f..367a00837 100644 --- a/snapshots/testsuite/testsuite.go +++ b/snapshots/testsuite/testsuite.go @@ -18,6 +18,8 @@ package testsuite import ( "context" + //nolint:golint + _ "crypto/sha256" "fmt" "io/ioutil" "math/rand" diff --git a/sys/oom_unix_test.go b/sys/oom_unix_test.go index 9bad2db53..e6be852bc 100644 --- a/sys/oom_unix_test.go +++ b/sys/oom_unix_test.go @@ -30,7 +30,7 @@ import ( ) func TestSetPositiveOomScoreAdjustment(t *testing.T) { - adjustment, err := adjustOom(123) + _, adjustment, err := adjustOom(123) if err != nil { t.Error(err) return @@ -44,7 +44,7 @@ func TestSetNegativeOomScoreAdjustmentWhenPrivileged(t *testing.T) { return } - adjustment, err := adjustOom(-123) + _, adjustment, err := adjustOom(-123) if err != nil { t.Error(err) return @@ -58,32 +58,37 @@ func TestSetNegativeOomScoreAdjustmentWhenUnprivilegedHasNoEffect(t *testing.T) return } - adjustment, err := adjustOom(-123) + initial, adjustment, err := adjustOom(-123) if err != nil { t.Error(err) return } - assert.Check(t, is.Equal(adjustment, 0)) + assert.Check(t, is.Equal(adjustment, initial)) } -func adjustOom(adjustment int) (int, error) { +func adjustOom(adjustment int) (int, int, error) { cmd := exec.Command("sleep", "100") if err := cmd.Start(); err != nil { - return 0, err + return 0, 0, err } defer cmd.Process.Kill() pid, err := waitForPid(cmd.Process) if err != nil { - return 0, err + return 0, 0, err + } + initial, err := GetOOMScoreAdj(pid) + if err != nil { + return 0, 0, err } if err := SetOOMScore(pid, adjustment); err != nil { - return 0, err + return 0, 0, err } - return GetOOMScoreAdj(pid) + adj, err := GetOOMScoreAdj(pid) + return initial, adj, err } func waitForPid(process *os.Process) (int, error) {