Skip to content

[CI]: rewrite some compose tests - #4203

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:2025-05-compose-tests-1
May 20, 2025
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:2025-05-compose-tests-1

Conversation

@apostasie

@apostasie apostasie commented May 6, 2025 •

Copy link
Copy Markdown
Contributor

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:

  • making them running parallel to reduce total CI runtime
  • moving them out of the "with-retry" bucket

A few notes:

  • removing version: XYZ in most cases from compose yml, as this is deprecated and is just printing additional noise
  • removing ports being exposed when not necessary for the test (as this was hardcoded to 8080, it would prevent tests from running in parallel)
  • no longer manually poke image name and instead use referenceutils to parse them properly when needed (in preparation for upgrading test images to digest-pinning)
  • some tests have been consolidated into subtests (cut the additional cost on tear-up / tear-down when not needed)

@apostasie apostasie changed the title [CI]: rewrite some compose tests [WIP] [CI]: rewrite some compose tests May 6, 2025
@apostasie
apostasie force-pushed the 2025-05-compose-tests-1 branch 7 times, most recently from 6040b4b to a2d90cb Compare May 7, 2025 15:14
@apostasie apostasie closed this May 7, 2025
@apostasie apostasie reopened this May 7, 2025
@apostasie
apostasie force-pushed the 2025-05-compose-tests-1 branch from a2d90cb to b7ea103 Compare May 10, 2025 17:36
@apostasie apostasie closed this May 10, 2025
@apostasie apostasie reopened this May 10, 2025
@apostasie apostasie closed this May 11, 2025
@apostasie apostasie reopened this May 11, 2025
@apostasie
apostasie force-pushed the 2025-05-compose-tests-1 branch 2 times, most recently from 4bc5fb9 to 8aac483 Compare May 14, 2025 17:04
@apostasie apostasie changed the title [WIP] [CI]: rewrite some compose tests [CI]: rewrite some compose tests May 14, 2025
@apostasie
apostasie marked this pull request as ready for review May 14, 2025 17:50
@apostasie

apostasie commented May 14, 2025 •

Copy link
Copy Markdown
Contributor Author

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

@apostasie
apostasie force-pushed the 2025-05-compose-tests-1 branch from 8aac483 to d17c009 Compare May 17, 2025 19:10
@apostasie
apostasie force-pushed the 2025-05-compose-tests-1 branch from d17c009 to 2c26839 Compare May 17, 2025 19:11
@apostasie

Copy link
Copy Markdown
Contributor Author

Rebased.

Sir reviewer @Shubhranshu153 - wanna do a quick review on this? 😇

@Shubhranshu153

Copy link
Copy Markdown
Contributor

Apologies. Currently I am over phone. I will be able to check in the evening.

@apostasie

Copy link
Copy Markdown
Contributor Author

Apologies. Currently I am over phone. I will be able to check in the evening.

No rush at all :-)

@apostasie

Copy link
Copy Markdown
Contributor Author

Failure is the usual TestIPFSCompNoBuild/with-no-stargz-no-byAddr

@@ -19,20 +19,29 @@ package compose
import (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Version test: Logic for pre change and post change matches.

expected := icmd.Expected{
ExitCode: 1,
Err: `invalid runtime name`,
testCase := nerdtest.Setup()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Missing test Description.

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.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok then it's not relevant. Thanks

# tempdir/foo should be automatically created
- %s:/mnt
`, testutil.CommonImage, data.Temp().Path("foo"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: test case Description.

@@ -17,66 +17,88 @@
package compose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified pre change and post change logic is consistent.

@@ -20,20 +20,16 @@ import (
"fmt"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified before and after logic is consistent.

@@ -18,22 +18,22 @@ package compose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

verified the logic remains consistent after change.

defer comp.CleanUp()
projectName := comp.ProjectName()
t.Logf("projectName=%q", projectName)
testCase := nerdtest.Setup()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: missing test description

testCase.Cleanup = func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("compose", "-f", data.Temp().Path("compose.yaml"), "down")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: add test description

@@ -18,16 +18,18 @@ package compose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified logic remains consistent after the refactor.

@@ -18,23 +18,22 @@ package compose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems too specific of a use case to put it in tigron.

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.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok 👌

@@ -17,24 +17,26 @@
package compose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

logic remains consistent after the refactor.

@Shubhranshu153

Copy link
Copy Markdown
Contributor

Approved few nits but looks good to me.
Seems i dont have write access yet though.

@apostasie

Copy link
Copy Markdown
Contributor Author

Approved few nits but looks good to me. Seems i dont have write access yet though.

Thanks a lot for the thorough review @Shubhranshu153

Appreciated!

@Shubhranshu153

Copy link
Copy Markdown
Contributor

@AkihiroSuda requires one more +1. Seems I don't have write access. Thank You

@apostasie

Copy link
Copy Markdown
Contributor Author

@AkihiroSuda gentle ping

@AkihiroSuda AkihiroSuda added this to the v2.1.2 milestone May 20, 2025

@AkihiroSuda AkihiroSuda left a comment

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.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 68c4acf into containerd:main May 20, 2025
@apostasie

Copy link
Copy Markdown
Contributor Author

Thanks @AkihiroSuda

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