Repository navigation
[CI]: rewrite some compose tests - #4203
Conversation
6040b4b to
a2d90cb
Compare
a2d90cb to
b7ea103
Compare
4bc5fb9 to
8aac483
Compare
|
Failure seems unrelated. Been sitting on this as well for a while, as unrelated failures (CNIEnv, logs) were getting in the way. Poking @AkihiroSuda and @fahedouch |
8aac483 to
d17c009
Compare
Signed-off-by: apostasie <[email protected]>
d17c009 to
2c26839
Compare
|
Rebased. Sir reviewer @Shubhranshu153 - wanna do a quick review on this? 😇 |
|
Apologies. Currently I am over phone. I will be able to check in the evening. |
No rush at all :-) |
|
Failure is the usual |
| @@ -19,20 +19,29 @@ package compose | |||
| import ( | |||
There was a problem hiding this comment.
Version test: Logic for pre change and post change matches.
| expected := icmd.Expected{ | ||
| ExitCode: 1, | ||
| Err: `invalid runtime name`, | ||
| testCase := nerdtest.Setup() |
There was a problem hiding this comment.
Nit: Missing test Description.
There was a problem hiding this comment.
For top-level tests, Description is a no-op. We can still add them to provide extra context for the reader of course, but the test name will always be the name of the wrapping function (eg: TestWhatever).
On the other hand, Description is mandatory for subtests as they provide the subtest name.
Let me know if you want me to add them though, happy to.
There was a problem hiding this comment.
Ok then it's not relevant. Thanks
| # tempdir/foo should be automatically created | ||
| - %s:/mnt | ||
| `, testutil.CommonImage, data.Temp().Path("foo")) | ||
|
|
There was a problem hiding this comment.
nit: test case Description.
| @@ -17,66 +17,88 @@ | |||
| package compose | |||
There was a problem hiding this comment.
Verified pre change and post change logic is consistent.
| @@ -20,20 +20,16 @@ import ( | |||
| "fmt" | |||
There was a problem hiding this comment.
Verified before and after logic is consistent.
| @@ -18,22 +18,22 @@ package compose | |||
|
|
|||
There was a problem hiding this comment.
verified the logic remains consistent after change.
| defer comp.CleanUp() | ||
| projectName := comp.ProjectName() | ||
| t.Logf("projectName=%q", projectName) | ||
| testCase := nerdtest.Setup() |
There was a problem hiding this comment.
nit: missing test description
| testCase.Cleanup = func(data test.Data, helpers test.Helpers) { | ||
| helpers.Anyhow("compose", "-f", data.Temp().Path("compose.yaml"), "down") | ||
| } | ||
|
|
There was a problem hiding this comment.
nit: add test description
| @@ -18,16 +18,18 @@ package compose | |||
|
|
|||
There was a problem hiding this comment.
Verified logic remains consistent after the refactor.
| @@ -18,23 +18,22 @@ package compose | |||
|
|
|||
There was a problem hiding this comment.
Logic is consistent.
| return helpers.Command("compose", "-f", data.Labels().Get("composeYaml"), "images", "--format", "json") | ||
| }, | ||
| Expected: test.Expects(expect.ExitCodeSuccess, nil, expect.All( | ||
| expect.JSON([]composeContainerPrintable{}, func(printables []composeContainerPrintable, s string, t tig.T) { |
There was a problem hiding this comment.
seems too specific of a use case to put it in tigron.
There was a problem hiding this comment.
Are you talking about expect.JSON?
If yes: it uses generics (JSON[T any](obj T, verifier func(T, string, tig.T))) - so, it can be used with whatever struct you want.
| @@ -17,24 +17,26 @@ | |||
| package compose | |||
There was a problem hiding this comment.
logic remains consistent after the refactor.
|
Approved few nits but looks good to me. |
Thanks a lot for the thorough review @Shubhranshu153 Appreciated! |
|
@AkihiroSuda requires one more +1. Seems I don't have write access. Thank You |
|
@AkihiroSuda gentle ping |
|
Thanks @AkihiroSuda |
This PR is rewriting some compose tests (as many as I can stomach in one sitting) to the new test framework.
Obviously I am mostly interested in:
A few notes:
version: XYZin most cases from compose yml, as this is deprecated and is just printing additional noise