test: refactor compose_ps_linux_test.go to use tigron#4790
test: refactor compose_ps_linux_test.go to use tigron#4790Siddhesh002 wants to merge 1 commit intocontainerd:mainfrom
Conversation
| @@ -27,10 +27,20 @@ import ( | |||
|
|
|||
| "github.com/containerd/nerdctl/v2/pkg/tabutil" | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Thanks for the suggestion
I've applied the formatting fix and amended the commit
Looks like the lint issue is resolved now
38f7c72 to
d2d0621
Compare
|
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 |
haytok
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Does NoParallel need to be true?
| testCase := nerdtest.Setup() | ||
|
|
||
| testCase.NoParallel = true | ||
| testCase.Require = nerdtest.Private |
There was a problem hiding this comment.
Is it really necessary to keep it private?
|
|
||
| helpers.Ensure("compose", "-f", composePath, "up", "-d") | ||
|
|
||
| time.Sleep(2 * time.Second) |
There was a problem hiding this comment.
Is this used to ensure the container starts? If so, you can use EnsureContainerStarted.
| } | ||
|
|
||
| func TestComposePsJSON(t *testing.T) { | ||
|
|
There was a problem hiding this comment.
IMO, this new line is unnecessary.
|
|
||
| helpers.Ensure("compose", "-f", composePath, "up", "-d") | ||
|
|
||
| time.Sleep(2 * time.Second) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Could you re-write using nerdtest.Docker
| testCase := nerdtest.Setup() | ||
|
|
||
| testCase.NoParallel = true | ||
| testCase.Require = nerdtest.Private |
Thanks for checking. The tests that are currently failing are flaky ... :( So they need to be retried in CI. Since the tests that @Siddhesh002 refactored are passing, it would be better to retry them once the fixes are complete. |
Signed-off-by: Siddhesh Suryawanshi <siddheshsuryawanshi@ibm.com>
d2d0621 to
f8495d3
Compare
|
Thanks for the review! @haytok Removed NoParallel Let me know if any further changes are needed |
| comp := testutil.NewComposeDir(t, dockerComposeYAML) | ||
| defer comp.CleanUp() | ||
| projectName := comp.ProjectName() | ||
| t.Logf("projectName=%q", projectName) |
There was a problem hiding this comment.
Please write this deleted row in testCase.Setup.
| } | ||
|
|
||
| testCase.SubTests = []*test.Case{ | ||
|
|
There was a problem hiding this comment.
NIT: Even when considering the tests for other refactoring PRs, there are no new lines between the tests, so it’s better to remove them (e.g., L117, L127, L137, ...). Please check the other relevant sections as well.
| base.ComposeCmd("-f", comp.YAMLFullPath(), "ps", "--format", "json", "wordpress"). | ||
| AssertOutWithFunc(assertHandler("wordpress", 0)) | ||
| testCase.SubTests = []*test.Case{ | ||
|
|
There was a problem hiding this comment.
NIT: Even when considering the tests for other refactoring PRs, there are no new lines between the tests, so it’s better to remove them (e.g., L262, L278, ...). Please check the other relevant sections as well.
| comp := testutil.NewComposeDir(t, dockerComposeYAML) | ||
| defer comp.CleanUp() | ||
| projectName := comp.ProjectName() | ||
| t.Logf("projectName=%q", projectName) |
There was a problem hiding this comment.
Please write this deleted row in testCase.Setup.
Refactor compose_ps_linux_test.go to use tigron testing framework
Related: #4613
FYI @mikebrow