Repository navigation
ci: Allow skipping specific tests - e.g. TestModule - or only run specific ones - #7863
Conversation
|
Hm, interested to hear @sipsma's thoughts as well, but I'm not entirely convinced on the value of splitting these out. That said, I don't really see any huge harm in it. I do think though that we should feel the pain of having big jobs be slow, etc - I know we're trying to get test runs under 10 minutes, but I think we should do that by fixing actual performance issues, instead of splitting up the runs. There's also a small risk that by reducing the amount of parallelism we have in our tests we are less likely to encounter some of the tricky parallel bugs we find like #7900 and #7662 (which while bad for regular users, is useful for us). We know that the module tests are the heaviest - a huge number of our new tests are added as module tests, since we're very much module focused at the moment. In practice - we could probably even do to split our There's definitely an issue with high disk usage (which needs some dedicated investigation time) - but does splitting them actually reduce disk usage? I guess the jobs are more split out, so we reduce contention for a single machine. |
|
Shower thought tier analysis: It seems like our module test suite spends a ton of time calling Either that or we need to somehow magically speed up Maybe our tests could even share the same client/session? There's always a risk of getting further from reality as we optimize the tests, but the other side of that coin is whether our tests are realistic as-is, and if we're bending over backwards to support unrealistic scenarios. Not making a call there one way or another, just raising the point, since our test suite growth strikes me as more ad hoc than planned/designed. In production for example it seems more common to have a single global client. I do agree that I'd rather try optimizations like above than divvy up the suite. |
|
First off, the metrics are super useful @gerhard, thank you! We've definitely had vague awareness that disk was something of a bottleneck previously, but I'm still surprised the extent to which it is based on this. Extremely useful to know. That being said, I agree with the sentiment that we should understand the performance problems more deeply before refactoring the tests. If we drill down the metrics to a finer grain and use that to fix the performance problems then we are benefitting both users and ourselves rather than just updating our own tests. Specifically, I think we need to at least know the answer to "what processes are consuming the disk bandwidth" based on actual measurements (though the finer grain the better, e.g. what a specific process is doing that is consuming bandwidth). 100% agree that the SDKs and reading/writing deps is a top suspect, but IME it's very much worth confirming with data since you will 99.9% of the time discover at least one surprising performance bottleneck once you measure it.
@gerhard I know you've done trials with parca and such, do you think those or anything similar would be able to help get deeper metrics on the source of the disk bandwidth hogs? |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
I agree with the "keep investigating" part, and I think that we should release our The context is more nuanced, and while one new genuine issue is responsible for nearly half of all the failures mentioned above, the other half is the following tests in
If we want to keep the test suite as is, I think that we should do the following:
In the spirit of moving this forward, I intend to:
How does the above sound? |
|
These are also potentially legitimate issues:
The first two seem potentially related - files are getting cached incorrectly, it was expected that this was fixed as part of #7900, but it seems like it still continues to happen. The problem with removing these test is - there's nothing in these tests that we can identify that specifically causes the flake. Potentially, if we remove these tests today, maybe some new tests we add tomorrow will trigger the same behavior? To clarify - the tests are correct - something in the engine is wrong. I don't think removing the tests is the right call. Potentially, we could have a retry loop for these known flaky tests? That way we can continue to run them, but we give them an amount of tolerance to pass? That's still hacky and annoying, but the tests do test for valuable behavior.
I don't think there's a time that works consistently for everyone - without asking folks to wake up early or stay late consistently, which I'm definitely not personally able to commit to. I'm okay with timeboxing time to try investigating, but I don't think having everyone in a call together is feasible (or even necessarily productive). Additionally, we currently have two of the core team currently on leave - I don't think we can do anything this extreme until they are back. My suggestion is to loop any known flaking tests, with a delay in between attempts. This is a quick fix that should hopefully remove the flakes without removing any test coverage. |
| // Run specific tests | ||
| func (t *Test) Specific( | ||
| ctx context.Context, | ||
| // Only run test tests |
sipsma
left a comment
There was a problem hiding this comment.
This is breaking testdev atm: https://github.com/dagger/dagger/actions/runs/10477444049/job/29018560013?pr=7863#step:3:1125
Otherwise the support for specifying tests to skip LGTM!
|
Also, on the topic of what to do to get all these flakes under control:
|
|
@sipsma fixing that job failure was the first thing on my list today. What makes the test flakes interesting is that I did not hit a single one in the 30-50 runs over the last few days. I am however able to get the I am still trying to narrow down the specific combination of factors which makes tests more likely to fail. While I have some clues, I will be continuing with capturing context in #8184 so that anyone is able to reproduce the same state, and then have it "frozen" so that we can continue digging deeper. |
… specific one
This PR replaces the `test custom` subcommand with `test specific`, e.g.:
dagger call --source=.:default test specific --skip=TestModule
In the example above, we run all tests **except** the `TestModule` ones.
To **only** run `TestModule` tests, the command is:
dagger call --source=.:default test specific --run=TestModule
Also, `test important` is now:
dagger call --source=.:default test specific --run='TestModule|TestContainer'
Here are a few more examples:
# Only run TestContainer, TestDirectory and TestFile tests
dagger call --source=.:default test specific --run="TestContainer|TestDirectory|TestFile"
# Skip all tests starting with TestLoad
dagger call --source=.:default test specific --skip="TestLoad"
# Skip all tests starting with TestC, TestD, TestE, ..., TestZ
dagger call --source=.:default test specific --skip="Test[C-Z]"
The other useful feature about the `--skip` flag is that now we can add
additional metadata to these runs. In the following example, I am
running all tests and capturing the specific instance properties in the
`--skip` flag (somewhat hacky, but essential for distinguishing runs in
Dagger Cloud):
```console
dagger call --source=.:default test specific --skip="32C-6548N|64GB-DDR5|VIRTIO-NVME"
```
All tests are now running in verbose `-v` mode so that we can see the
`go test` output in addition to the Dagger Cloud Traces. We can't fully
trust those yet **in this context**.
[FTR](#8184).
This also adds a new test subcommand which lists all top-level tests in
alphabetical order:
dagger call --source=.:default test list
TestBaseVersion
TestBasic
...
Signed-off-by: Gerhard Lazu <[email protected]>
| function: "test specific --run=TestModule --race=true --parallel=16" | ||
| upload-logs: true | ||
|
|
||
| test-everything-else: |
There was a problem hiding this comment.
I'm still a bit concerned about splitting these out, but I understand the logic. My worry is that there is some lurking bug underneath that we need to fix - but that by splitting the tests out we're simply brushing it under the carpet.
That said, I won't block on that - but I think we need to have a long-term goal to eventually merge these back together, and fix the underlying issue. It does feel unlikely that the specific bug we're seeing is currently impacting users, so I can be convinced that this approach is worth it.
There was a problem hiding this comment.
This PR was changed from the original to in addition to test. In other words:
testremained unchangedtest-modulesis a subset oftesttest-everything-elseis the other part oftest
In summary: test = test-modules + test-everything-else
We can now compare how this test suite behaves as a single unit test, as well as split into test-modules + test-everything-else
|
This now looks good to me, including the final log artefacts that we generate:
Worth noting:
This is what the CI runner resources looked like while the above were running: I am curious to see how the various test suites behave after a few runs. FWIW @vito @crjm, after Screen.Recording.2024-08-21.at.10.40.05.mp4As a suggestion on how to make this experience better, it would have helped to have the "outer layer" load within a minute or two the most. If I clicked around and needed more data, grabbing that in follow-up requests would have been ideal. The thing which I missed the most was a loading progress indicator which would have told me how much data was downloaded, and how much is left to download. OK, it finished loading by the time I typed all of this up. |
We introduced an alternative workflow which splits the big test suites into smaller ones that have appropriately-sized CI runners. Context: - #7863 - #8212 Now that we have been running both workflows in parallel for 4 months and have a long-term understanding of their behaviour, we are going to **temporarily** pause the less reliable jobs and save on infra costs. For more details on the two workflows see this original issue description which has been kept up-to-date all these months: - #8184 As a reminder, we are doing this change so that we: - mark a new milestone in this saga which started 6 months ago, in May 2024: #7339 - make progress towards `All our jobs succeed 90% of the time and finish within 10 minutes` (this change effectively makes our longest job be ~11mins) - make all contributors wait less for all PR checks to be green (including re-running jobs which fail intermittently) - save on CI infra costs which have doubled since September and are on track to reach `$10k` just for November Signed-off-by: Gerhard Lazu <[email protected]>






Note
While this PR started by splitting our Engine & CLI tests in
TestModuleand everything else, it has since been changed. We are keeping the existing test suite as is, while adding two new test suites:test-moduletest-everything-elseThis is meant to inform the next steps for:
This PR replaces the
test customsubcommand withtest specific, e.g.:dagger call --source=.:default test specific --skip=TestModuleIn the example above, we run all tests except the
TestModuleones. To only runTestModuletests, the command is:dagger call --source=.:default test specific --run=TestModuleAlso,
test importantis now:dagger call --source=.:default test specific --run='TestModule|TestContainer'Here are a few more examples:
All tests are now running in verbose
-vmode so that we can see thego testoutput in addition to the Dagger Cloud Traces. We can't fully trust those yet in this context. FTR.The other useful feature about the
--skipflag is that now we can add additional metadata to these runs. In the following example, I am running all tests and capturing the specific instance properties in the--skipflag (somewhat hacky, but essential for distinguishing runs in Dagger Cloud):dagger call --source=.:default test specific --skip="32C-6548N|64GB-DDR5|VIRTIO-NVME"This also adds a new test subcommand which lists all top-level tests in alphabetical order:
Note
While this is how this PR started, I am only keeping it here so that the first several comments make sense. Only the content above this line is relevant for the merged changes.
This PR splits our Engine & CLI tests into:
We now run them as separate CI jobs which splits the test data and makes it easier to understand where the slowness is coming from. It should also make it easier to focus our test refactoring efforts on module tests since the rest of our test suite doesn't seem to be a problem.
Furthermore, before this change, running all these tests in CI was putting pressure on a bunch of components as they generate a lot (>200MB) of output. Even though https://dagger.cloud processes all this data, we then keep stalling the browser tab since it cannot handle a DOM that large. Yup, hundreds of megabytes.
When I run module tests locally, they take over 1h which makes them impractical. All other tests complete within 10 minutes (regardless whether we use
-raceor not). This is what I've learned:TestModule
3642s(timed out) @ Wed 10 Jul 08:42:25 BST 20243632s(timed out) @ Wed 10 Jul 10:12:09 BST 2024TestContainer
442s@ Wed 10 Jul 08:49:47 BST 2024280s@ Wed 10 Jul 12:06:55 BST 2024TestEngine
141s@ Wed 10 Jul 08:52:08 BST 2024120s@ Wed 10 Jul 12:12:53 BST 2024115s@ Wed 10 Jul 12:15:21 BST 2024All other test suites combined
166s@ Wed 10 Jul 07:38:34 BST 2024146s@ Wed 10 Jul 07:41:43 BST 2024145s@ Wed 10 Jul 10:43:38 BST 2024136s@ Wed 10 Jul 11:55:14 BST 2024This PR also changes:
dagger call ... test listdagger call ... test customis nowdagger call ... test specificdagger call ... test importantimportanttests now means everything else apart from modules, which we know are the heavy part of our test suiteAnother interesting observation when running
TestModuleonly locally: the NVMe disk gets fully saturated (22k writes @ 26MB/s gives us an average of 1KB / write operation). All other resources (CPU / memory / network) are plenty:I am keen to see how this behaves in our CI. I am also curious to hear what others think about this change, especially @sipsma & @jedevc that have been doing a lot of work in this area recently.