Skip to content

test: refactor compose_ps_linux_test.go to use tigron#4790

Open
Siddhesh002 wants to merge 1 commit intocontainerd:mainfrom
Siddhesh002:refactor-compose-ps-tests
Open

test: refactor compose_ps_linux_test.go to use tigron#4790
Siddhesh002 wants to merge 1 commit intocontainerd:mainfrom
Siddhesh002:refactor-compose-ps-tests

Conversation

@Siddhesh002
Copy link

Refactor compose_ps_linux_test.go to use tigron testing framework

Related: #4613

FYI @mikebrow

@@ -27,10 +27,20 @@ import (

"github.com/containerd/nerdctl/v2/pkg/tabutil"
Copy link
Member

Choose a reason for hiding this comment

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

I'm on VSC using the GO tools extension from google. It has a setting for the GO Format tool that defaults to using gofmt. With that extension plugged in gofmt sorts the imports on saving the file. git commit --amend .. push the commit to your origin and should be all good to go

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion
I've applied the formatting fix and amended the commit
Looks like the lint issue is resolved now

Signed-off-by: Siddhesh Suryawanshi <siddheshsuryawanshi@ibm.com>
@Siddhesh002 Siddhesh002 force-pushed the refactor-compose-ps-tests branch from 38f7c72 to d2d0621 Compare March 13, 2026 15:04
@mikebrow
Copy link
Member

log of your modified test cases appears correct, not sure about all the flake/other test issues.

https://github.com/containerd/nerdctl/actions/runs/23056928875/job/66973560088?pr=4790

PASS cmd/nerdctl/compose.TestComposePs/compose_ps_alpine_-a (0.04s)
PASS cmd/nerdctl/compose.TestComposePs/compose_ps_wordpress (0.06s)
PASS cmd/nerdctl/compose.TestComposePs/compose_ps_should_not_show_alpine_unless_running (0.09s)
PASS cmd/nerdctl/compose.TestComposePs/compose_ps_db (0.11s)
PASS cmd/nerdctl/compose.TestComposePs/compose_ps_services (0.09s)
PASS cmd/nerdctl/compose.TestComposePs/compose_ps_filter_exited (0.09s)
PASS cmd/nerdctl/compose.TestComposePs (24.10s)
PASS cmd/nerdctl/compose.TestComposePsJSON/ps_json_all_services (0.03s)
PASS cmd/nerdctl/compose.TestComposePsJSON/wordpress_running (0.03s)
PASS cmd/nerdctl/compose.TestComposePsJSON/stop_wordpress (1.16s)
PASS cmd/nerdctl/compose.TestComposePsJSON/wordpress_exited (0.03s)
PASS cmd/nerdctl/compose.TestComposePsJSON/remove_wordpress (6.12s)
PASS cmd/nerdctl/compose.TestComposePsJSON/wordpress_removed (0.02s)
PASS cmd/nerdctl/compose.TestComposePsJSON/unsupported_format_should_fail (0.01s)
PASS cmd/nerdctl/compose.TestComposePsJSON (20.79s)

Copy link
Member

@haytok haytok left a comment

Choose a reason for hiding this comment

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

Thanks for creating this PR! I’ve made a few comments, so could you check when you have time?

base := testutil.NewBase(t)
testCase := nerdtest.Setup()

testCase.NoParallel = true
Copy link
Member

Choose a reason for hiding this comment

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

testCase := nerdtest.Setup()

testCase.NoParallel = true
testCase.Require = nerdtest.Private
Copy link
Member

Choose a reason for hiding this comment

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


helpers.Ensure("compose", "-f", composePath, "up", "-d")

time.Sleep(2 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Is this used to ensure the container starts? If so, you can use EnsureContainerStarted.

}

func TestComposePsJSON(t *testing.T) {

Copy link
Member

Choose a reason for hiding this comment

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

IMO, this new line is unnecessary.


helpers.Ensure("compose", "-f", composePath, "up", "-d")

time.Sleep(2 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Can we use EnsureContainerStarted ?

func TestComposePsJSON(t *testing.T) {

// docker parses unknown 'format' as a Go template and won't output an error
testutil.DockerIncompatible(t)
Copy link
Member

Choose a reason for hiding this comment

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

Could you re-write using nerdtest.Docker

testCase := nerdtest.Setup()

testCase.NoParallel = true
testCase.Require = nerdtest.Private
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@haytok
Copy link
Member

haytok commented Mar 14, 2026

log of your modified test cases appears correct, not sure about all the flake/other test issues.
https://github.com/containerd/nerdctl/actions/runs/23056928875/job/66973560088?pr=4790

Thanks for checking. The tests that are currently failing are flaky ... :( So they need to be retried in CI.

=== Failing tests ===
TestLogs
TestLogs/since_60s
TestLogs/until_60s
=====================

=== Failing tests ===
TestLoadStdinFromPipe
=====================

=== Failing tests ===
TestIPFSAddrWithKubo
TestLoadQuiet
=====================

Since the tests that @Siddhesh002 refactored are passing, it would be better to retry them once the fixes are complete.

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