Skip to content

test: refactor container_run_restart_linux_test.go to use Tigron#4916

Open
opjt wants to merge 1 commit into
containerd:mainfrom
opjt:issues_4613_container_run_restart_linux_test.go
Open

test: refactor container_run_restart_linux_test.go to use Tigron#4916
opjt wants to merge 1 commit into
containerd:mainfrom
opjt:issues_4613_container_run_restart_linux_test.go

Conversation

@opjt
Copy link
Copy Markdown
Contributor

@opjt opjt commented May 18, 2026

Review point

1. killDaemon / ensureDaemonActive / dumpDaemonLogs location

These helpers were previously methods on testutil.Base and are used only by TestRunRestart in this file.
I've kept them inline (package-private functions) in the test file

if the project expects more daemon-resilience tests in the future, moving them to pkg/testutil/nerdtest/ (e.g., daemon_linux.go) as exported helpers make sense.

2. nerdtest.ContainerdPlugin plugin type

The migrated tests keep io.containerd.internal.v1 to match original behavior. In newer containerd (verified on v2.2.1) this plugin has moved:

$ sudo ctr plugins ls | grep restart
io.containerd.monitor.container.v1   restart   -   ok

As a result, the 4 tests skip on the v2.x CI jobs but still run on the legacy jobs.
Updating the type (or supporting both) is left as a follow-up.

@opjt opjt marked this pull request as draft May 18, 2026 23:53
@opjt opjt force-pushed the issues_4613_container_run_restart_linux_test.go branch 2 times, most recently from 15e1509 to a358a18 Compare May 19, 2026 03:32
@opjt opjt marked this pull request as ready for review May 19, 2026 08:36
@AkihiroSuda AkihiroSuda added this to the v2.3.2 milestone May 28, 2026
if err == nil {
// The daemon is now running, but the daemon may still refuse connections to containerd.sock
t.Log(fmt.Sprintf("daemon %q is now running, checking whether the daemon can handle requests", target))
infoOut, infoErr := exec.Command(testutil.GetTarget(), "info").CombinedOutput()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use helpers.Command?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop needs to know whether info succeeded without failing the test on intermediate attempts.
As far as I could find, Tigron doesn't offer a way to do both:

  • Run returns nothing
  • Ensure/Capture fatal on non-zero exit, and Anyhow doesn't expose success.

exec.Command was the simplest fit. Open to suggestions if there's a pattern I missed.

Signed-off-by: Park jungtae <jtpark1957@gmail.com>
@opjt opjt force-pushed the issues_4613_container_run_restart_linux_test.go branch from a358a18 to b08f8af Compare May 28, 2026 23:05
return &test.Requirement{
Check: func(data test.Data, helpers test.Helpers) (bool, string) {
if IsDocker() {
return true, ""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker target doesn't use containerd plugins, so the check isn't applicable.
Returning true lets the test still run on Docker, matching the original

if !nerdtest.IsDocker() {
		testutil.RequireContainerdPlugin(base, "io.containerd.internal.v1", "restart", []string{"unless-stopped"})
	}

behavior.

@opjt opjt requested a review from AkihiroSuda May 30, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants