Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to 24.04 for docker tests #3178

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ jobs:
run: GO_VERSION="$(echo ${{ matrix.go-version }} | sed -e s/.x//)" make binaries

test-integration-docker-compatibility:
runs-on: ubuntu-22.04 # TODO: ubuntu-24.04
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/[email protected]
Expand Down
17 changes: 12 additions & 5 deletions cmd/nerdctl/container_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,20 @@ func TestLogsWithForegroundContainers(t *testing.T) {
}

func TestTailFollowRotateLogs(t *testing.T) {
t.Parallel()
// FIXME this is flaky by nature... 5 lines is arbitrary, 2000 ms is arbitrary, and both are some sort of educated
// guess that things will mostly always kinda work maybe...
// Furthermore, parallelizing will put pressure on the daemon which might be even slower in answering, increasing
// the risk of transient failure.
// This test needs to be rethought entirely
// t.Parallel()
if runtime.GOOS == "windows" {
t.Skip("tail log is not supported on Windows")
}
base := testutil.NewBase(t)
containerName := testutil.Identifier(t)

const sampleJSONLog = `{"log":"A\n","stream":"stdout","time":"2024-04-11T12:01:09.800288974Z"}`
const linesPerFile = 100
const linesPerFile = 5

defer base.Cmd("rm", "-f", containerName).Run()
base.Cmd("run", "-d", "--log-driver", "json-file",
Expand All @@ -227,10 +232,12 @@ func TestTailFollowRotateLogs(t *testing.T) {
"sh", "-euc", "while true; do echo A; done").AssertOK()

tailLogCmd := base.Cmd("logs", "-f", containerName)
tailLogCmd.Timeout = 100 * time.Millisecond
tailLogs := strings.Split(strings.TrimSpace(tailLogCmd.Run().Combined()), "\n")
tailLogCmd.Timeout = 2000 * time.Millisecond
tailLogs := strings.Split(strings.TrimSpace(tailLogCmd.Run().Stdout()), "\n")
for _, line := range tailLogs {
assert.Equal(t, "A", line)
if line != "" {
assert.Equal(t, "A", line)
}
}
assert.Equal(t, true, len(tailLogs) > linesPerFile)
}
14 changes: 11 additions & 3 deletions cmd/nerdctl/container_run_cgroup_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,12 @@ func TestRunCgroupParent(t *testing.T) {
t.Parallel()
base := testutil.NewBase(t)
info := base.Info()
containerName := testutil.Identifier(t)
defer base.Cmd("rm", "-f", containerName).Run()

switch info.CgroupDriver {
case "none", "":
t.Skip("test requires cgroup driver")
}

containerName := testutil.Identifier(t)
t.Logf("Using %q cgroup driver", info.CgroupDriver)

parent := "/foobarbaz"
Expand All @@ -314,6 +312,13 @@ func TestRunCgroupParent(t *testing.T) {
parent = "foobarbaz.slice"
}

tearDown := func() {
base.Cmd("rm", "-f", containerName).Run()
}

tearDown()
t.Cleanup(tearDown)

// cgroup2 without host cgroup ns will just output 0::/ which doesn't help much to verify
// we got our expected path. This approach should work for both cgroup1 and 2, there will
// just be many more entries for cgroup1 as there'll be an entry per controller.
Expand All @@ -333,6 +338,9 @@ func TestRunCgroupParent(t *testing.T) {
expected := filepath.Join(parent, id)
if info.CgroupDriver == "systemd" {
expected = filepath.Join(parent, fmt.Sprintf("nerdctl-%s", id))
if base.Target == testutil.Docker {
expected = filepath.Join(parent, fmt.Sprintf("docker-%s", id))
}
}
base.Cmd("exec", containerName, "cat", "/proc/self/cgroup").AssertOutContains(expected)
}
Expand Down