Merge pull request #4719 from estesp/fix-shm-relabel-test

Reenable make test targets in GH Actions CI
This commit is contained in:
Wei Fu 2020-11-23 13:11:32 +08:00 committed by GitHub
commit 625da6b3e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 12 deletions

View File

@ -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

View File

@ -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])
}
}

View File

@ -18,6 +18,8 @@ package testsuite
import (
"context"
//nolint:golint
_ "crypto/sha256"
"fmt"
"io/ioutil"
"math/rand"

View File

@ -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) {