Repository navigation
Testing-rig fixes - #3384
Testing-rig fixes#3384
Conversation
8f4a611 to
96e2c80
Compare
96e2c80 to
937d059
Compare
937d059 to
46b4123
Compare
| func TestRunVolumeRelativePath(t *testing.T) { | ||
| t.Parallel() | ||
| base := testutil.NewBase(t) | ||
| base.Dir = t.TempDir() |
There was a problem hiding this comment.
Tests should not create temporary resources outside of temp directories (this is failing locally for me)
46b4123 to
fe25063
Compare
|
@AkihiroSuda this is ready. CI is (mostly) green (failure is the usual Should be merged after #3385. |
fe25063 to
995d242
Compare
995d242 to
3002d01
Compare
| ```bash | ||
| # Test all with nerdctl (rootless mode, if running go as a non-root user) | ||
| go test ./cmd/nerdctl/... | ||
| go test -p 1 ./cmd/nerdctl/... |
There was a problem hiding this comment.
Thanks, I think this is the reason why we have failed to split *_test.go.
In the document could you explain what is -p and how it differs from -parallel?
The explanation should be copied to GHA yamls too.
There was a problem hiding this comment.
I also wonder if we can print a human-readable error when -p 1 is not specified.
There was a problem hiding this comment.
Also wonder how this affects the run-time of the CI
There was a problem hiding this comment.
Also wonder how this affects the run-time of the CI
Theoretically, this MAY impact our run-time.
Currently, we first run sequentially any test that is not parallel. Then we run all tests that can be parallelized together, with parallelization at GOMAXPROCS.
With the new model, the tests that can be parallelized are run together, but only inside the subpackage (and each subpackage is run sequentially).
But then, how many cores do we have on github actions? 4?
Back of the envelop:
- 15 subpackages
- about 1000 tests -> ~70 tests per package
- 160 calls to t.Parallel (but then, for loops, so, let's say 300) -> ~20 tests marked parallel
If we do indead have a small number of cores (<=4), then it is likely close to zero impact...
There was a problem hiding this comment.
I also wonder if we can print a human-readable error when
-p 1is not specified.
Maybe?
We could have the test initialization method to check the status of an flock and bail-out with an error if it is in use?
A bit heavy-handed, but then, it might work.
There was a problem hiding this comment.
Thanks, I think this is the reason why we have failed to split
*_test.go.In the document could you explain what is
-pand how it differs from-parallel? The explanation should be copied to GHA yamls too.
Yes.
This is not fully trivial knowledge.
Done with latest push.
Signed-off-by: apostasie <[email protected]>
3002d01 to
76a828d
Compare
In preparation for #3379
Couple of things:
./cmd/nerdctl/...this will break on us. To prevent this, pass along-p 1which will instruct go test to only test one sub-package at a time. Note that this is not the same as parallelized tests - tests callingt.Parallelwill still be run in parallel with others (and this is controlled by-parallel)go tool). I do not know for sure why this was done (maybe @AkihiroSuda would know). My hunch is that this was motivated by the fact we ssh back into the container - which does lose both cwd and PATH. I did fix that intest-integration-rootless.shinstead, so that rootless can just use the familiar, normalgo testroutineThis is on-top of #3385 which should be merged first.