Add basic workflow for automatic subcommand testing on Windows.#1393
Add basic workflow for automatic subcommand testing on Windows.#1393aznashwan wants to merge 3 commits intocontainerd:mainfrom
Conversation
|
It might be worth discussing whether The rest of the failing commands currently being tested have clear causes for the most part ( |
| CONTAINERD_REF: 'main' | ||
| TEST_CONTAINER_IMAGE: 'k8s.gcr.io/e2e-test-images/busybox:1.29-2' | ||
|
|
||
| jobs: |
There was a problem hiding this comment.
Would it be better to have a test arg like docker.
go test -exec sudo -v ./cmd/nerdctl/... -args -test.target=docker
and if a test is windows compatible it will run automatically
|
Why not use the same test suite as Linux? Line 41 in 70bc5a9 |
d35f7c2 to
3ce3ad7
Compare
| @@ -0,0 +1,101 @@ | |||
| # This workflow runs the command test suite on GitHub-based Windows Server runners. | |||
There was a problem hiding this comment.
Could you explain pros/cons compared to the current Cirrus CI ?
There was a problem hiding this comment.
The main pro would be the fact the containerd repo has a workflow using the same GitHub runner images to run the integration tests, so we could crossref any errors we're seeing to any bugs which may have gotten into containerd without having to worry about differences in the runner's OS/patch number as much.
I don't think there are any cons to having both running in parallel, so I could also update the Cirrus config to run the tests on 2022 as well if needed. (currently looks like Cirrus only has images based on 2019 OOB so we'd have to setup a custom 2022 image for it though)
|
@AkihiroSuda @manugupt1 thanks a lot for the pointers! I've updated this PR in the following ways:
There's like a dozen existing tests which are skipped on Windows since they unequivocally require BuildKit as part of the test itself (mostly all of those prefixed with There's a couple of tests which outright fail and I'll be looking into next:
Lastly, some points I'd like to bring to your attention now (with separate PRs to work through these later):
|
3ce3ad7 to
e97def0
Compare
|
|
||
| defaults: | ||
| run: | ||
| shell: bash |
There was a problem hiding this comment.
Should this be bash or PowerShell?
There was a problem hiding this comment.
Good catch, the initial version of the workflow contained way more steps and mostly used bash in them but none do any more so I'll be updating the workflow to have PS as the default.
There was a problem hiding this comment.
Updated the PR to use PowerShell as the default shell FWIW.
| assert.Equal(t, string(data), testContent) | ||
| } | ||
|
|
||
| func createBuildContext(dockerfile string) (string, error) { |
There was a problem hiding this comment.
I had moved it to image_testing_utils.go since it is also called in a couple of non-build-related tests.
| "github.com/containerd/nerdctl/pkg/testutil" | ||
| ) | ||
|
|
||
| func TestRename(t *testing.T) { |
There was a problem hiding this comment.
Just curious: Why not have common tests in rename_test.go and platform specific tests in rename__test.go using build tags?
There was a problem hiding this comment.
As far as I could tell all the existing tests were laid out using the filename suffixes for build constraints so I strived to keep it that way.
I also needed to paraemtrize the test image since testutils.CommonImage is only defined on Linux/Windows/FreeBSD and that would prevent the tests from compiling on any other future platform we'd like to support.
We could alternatively set a default testutils.CommonImage for all platforms and thus have the TestRename* tests be 100% shared across all platforms.
I'd personally rather we move the CommonImage constants from testutils to here since it's only ever referenced in the ./cmd/nerdctl/... tests anyway...
Signed-off-by: Nashwan Azhari <[email protected]>
Signed-off-by: Nashwan Azhari <[email protected]>
Signed-off-by: Nashwan Azhari <[email protected]>
e97def0 to
a2c4cfa
Compare
|
Superseded by #2418. |
This PR adapts some existing command tests to run on both Linux and Windows, as well as add a simple GitHub action to run the command tests on Windows 2019/2022 automatically.