Repository navigation
Description
Reliable = pass 99% of the time.
Fast = < 10mins to pass.
| Dagger version | Engine & CLI main branch reliability | Pass duration (P95) | Fail duration (P95) |
|---|---|---|---|
v0.15.3 5 days, 18 runs |
17% |
20m |
23m |
v0.15.2 19 days, 64 runs |
50% |
22m |
32m |
v0.15.[0-1] 35 days, 140 runs |
56% |
22m |
32m |
v0.14.0 20 days, 66 runs |
46% |
22m |
22m |
v0.13.7 7 days, 38 runs |
57% |
20m |
32m |
v0.13.6 11 days, 27 runs |
77% |
18m |
35m |
v0.13.[4-5] 16 days, 62 runs |
72% |
26m |
32m |
v0.13.[2-3] 15 days, 57 runs |
70% |
36m |
39m |
v0.13.1 5 days, 19 runs |
60% |
29m |
18m |
v0.13.0 6 days, 38 runs |
70% |
36m |
39m |
👆 #8998 merged Engine & CLI split into Engine & CLI, only showing the split variant above:
Engine & CLI + Engine & CLI split
| Dagger version | Engine & CLI main reliability | Pass duration (P95) | Fail duration (P95) |
|---|---|---|---|
v0.14.0 9 days, 56 runs |
38% (split) 67% |
33m (split) 23m |
34m (split) 35m |
v0.13.7 7 days, 38 runs |
34% (split) 57% |
32m (split) 20m |
33m (split) 32m |
v0.13.6 11 days, 27 runs |
70% (split) 77% |
29m (split) 18m |
49m (split) 35m |
v0.13.[4-5] 16 days, 62 runs |
68% (split) 72% |
34m (split) 26m |
41m (split) 32m |
v0.13.[2-3] 15 days, 57 runs |
62% (split) 70% |
44m (split) 36m |
32m (split) 39m |
v0.13.1 5 days, 19 runs |
58% (split) 60% |
30m (split) 29m |
32m (split) 18m |
v0.13.0 6 days, 38 runs |
67% (split) 70% |
41m (split) 36m |
32m (split) 39m |
All the data above in one graph:
This is how past versions behaved:
| Dagger version | Engine & CLI main reliability | Pass duration (P95) | Fail duration (P95) |
|---|---|---|---|
v0.12.[6-7]13 days, 67 runs |
33% |
37m |
41m |
v0.12.514 days, 51 runs |
29% |
22m |
32m |
v0.12.410 days, 40 runs |
48% |
16m |
32m |
v0.12.37 days, 40 runs |
60% |
18m |
18m |
v0.12.26 days, 23 runs |
43% |
25m |
19m |
v0.12.[0-1]6 days, 46 runs |
20% |
23m |
33m |
v0.11.922 days, 129 runs |
42% |
41m |
26m |
v0.11.86 days, 22 runs |
72% |
26m |
18m |
All the data above in one graph:
This is a checkpoint in our attempt to make our Engine & CLI tests reliable & fast. It is meant to:
- remind us why we are doing this (after months with many distractions, it's easy to forget)
- collect & share observations in a single place (we've been doing this ad-hoc, mostly private)
- tie other related issues and pull requests
Why are we doing this?
We want the dagger/dagger Engine & CLI test suite to show off the most advanced & polished Dagger use case. We would like to have the most robust implementation - think production-ready - so that anyone is able to see what that means long-term. Looking at commits on main, there should be a sea of green checks.
The goal that we are aiming for is: 99% of runs on the main branch will succeed and complete within 10 minutes. We acknowledge that:
- During weeks with lots of churn,
99%may not be possible (we merge incomplete code, external dependencies fail, etc.) - While
10 minutesis a good starting point, if no code changes, this should be a few minutes at most with everything (queueing time, reporting, etc.)
What is the problem?
There are several:
- We cannot run all Engine & CLI tests locally, on regular hardware.
dagger call --source=.:default test allwill timeout after 30 minutes (default timeout).- Increasing the timeout to
180mdoes not help. Even if we would try with240m/360mand get it to work, it is impractical to wait 4h-6h for the entire test suite to complete.
- Increasing the timeout to
- We need server-grade machines to run all Engine & CLI tests
- Minimum
32vCPUs(and--parallel=16, otherwise it may fail depending on the NVMe disk quality & contention) - Top-end user grade NVMe disk (Samsung 990PRO) is not fast enough
- Minimum
192GB of RAMif we want to useTMPFS(a.k.a. ramdisk)
- Minimum
- As each full test run generates
90GBof data, we need to prune storage after ~10 runs - Some tests are failing intermittently only in our CI
- I am yet to see this happen in DigitalOcean, where Dagger runs in Docker (32vCPU compute optimised instances)
- We are able to run all tests locally if we
--skip=TestModule
- If nothing changes, running
dagger call --source=.:default test allthe second time takes almost as long as it did the first time (there is a3minsor20%difference). This means that caching does not work as expected in this context.
Related items (most recent first)
- ci: Restore testdev to the same coverage as it had before #8212 #8423
- ci: Move the Engine & CLI split test suites to a separate workflow #8407
- ci(flake): socket default not found #8385
- kernel warnings about invalid overlay mounts #8265
- Is this related? Module path resolution issues with nested dagger clients #8154
- AsModule & Initialize not Properly Cached within the same session #8254
- Cannot find default codegen
DaggerObjectinterface #8207 - ci: split
TestModuleinto multiple suites #8212 - Revert "tests: try killing subprocesses harder if they misbehave" #8196
- tests: try killing subprocesses harder if they misbehave #8191
- tests: move TypeScript test to its own suite #8185
- chore: increase verbosity of codegen error #8181
- tests: big deflake attempt #8168
- Tests require disabling go mod index pending upstream bug fix #8031
- Flaky test:
TestGoExtendCore-cannot define methods on objects from outside this module#7979 - ci: Allow skipping specific tests - e.g. TestModule - or only run specific ones #7863
- ephemeral
context cancelederrors #7699 - chore: use ContextCause everywhere #8274
- chore: annotate every cancel cause with message moby/buildkit#5278
- test flake: TestRemoteCacheRegistrySeparateImportExport -
connection refusedreaching registry #7681 - test flake: TestContainerSystemProxies #7672
- flaky test:
TestPythonProjectLayout-The "main" module could not be found#7662 - 🐞 Dagger CLI v0.11.4 deadlocks when running
dagger call --source=.:default test all#7387 - 🧐
dagger call --source=.:default test allis timing out locally - inconsistent behaviour #7339 - Intermittent
failed to get edge: inconsistent graph stateerrors #6234
What's next?
- Split
test&testdevsuites and see how they behave - Run a build matrix on: 1. Our CI 2. Depot 3. Namespace.
- Integrate https://github.com/jstemmer/go-junit-report + https://github.com/marketplace/actions/opentelemetry-upload-trace-artifact
- Integrate https://github.com/vakenbolt/go-test-report (export the resulting file to the GHA result)
- Run on
c6idsame as we do on all other instances. How does it compare to DO?- We are trying to figure out if there is a delta between our CI runners & the raw instance
How does this run locally, on a 16vCPU Linux host?
Given the following host:
16vCPUsAMD 5800X128GBDDR44TBSamsung 990PRO- Dagger
0.12.5on Docker27.1.1 - Linux
6.9.3via Ubuntu22.04LTS
This is the outcome of running dagger call --source=.:default test specific --run=TestModule:
You can find the Dagger Cloud trace here: https://dagger.cloud/dagger/traces/af42de097bc7e417f1af560d17fa4b42
These are all the test runs on this host using #7863:
| TEST SUITE | GOMAXPROCS 16 |
--parallel=8 |
|---|---|---|
test all --race=true 74G |
❌ 33m 26s |
❌ 33m 22s |
test specific --run=TestModule 60G |
❌ 32m 56s |
❌ 33m 8s |
test specific --skip=TestModule 38GB |
✅ 9m 59s |
✅ 9m 55s |
I then configured a 100GB ramdisk and ran the same tests again. TL;DR 100GB RAM is not enough.
| TEST SUITE | GOMAXPROCS 16 |
--parallel=8 |
|---|---|---|
test all --race=true 63G |
❌ 32m 20s (OOM) |
❌ 32m 14s (OOM) |
test specific --run=TestModule 60G |
❌ 32m 7s (OOM) |
❌ 32m 16s (OOM) |
test specific --skip=TestModule 37GB |
✅ 7m 8s |
✅ 7m 6s |
Key take aways
- Consumer grade-hardware is not powerful enough to run these tests
- 🤔 Would it work with
32vCPU?
How does this run on a 32vCPU DO CPU-optimized instance?
Given the following host perf-party-2024-08-20-c-32-intel-tor1-01:
32vCPUIntel Xeon Gold 6548N Processor64GBDDR5400GBVIRTIO NVMe- Dagger
0.12.5on Docker27.1.2 - Linux
6.8.0via Ubuntu24.04LTS
And the following setup:
curl -fsSL https://get.docker.com | sh
docker login
curl https://dl.dagger.io/dagger/install.sh | BIN_DIR=/usr/local/bin sh
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y
apt install tmux atop btop htop dstat
tmux
git clone https://github.com/gerhard/dagger
cd dagger
git checkout split-engine-test-all
dagger login dagger
dagger call --source=.:default test specific --skip="32C-6548N|64GB-DDR5|VIRTIO-NVME"
This is the outcome from various runs:
| TEST SUITE | GOMAXPROCS 32 |
--parallel=16 |
--parallel=8 |
|---|---|---|---|
test all --race=true 90G |
❌ 25m 35s |
❌ 25m 52s
❌ 17m 11s
✅ 14m 32s module cached | ✅ 18m 8s
✅ 15m 35s module cached | ✅ 23m 44s
✅ 21m 21s module cached |
| test specific --run=TestModule 60G | ✅ 10m 41s | ✅ 11m 53s | |
| test specific --skip=TestModule | | | |
And this is what the instance resources looked like during one of the test all --race=true run & test parallelism left at the default GOMAXPROCS 32 (notice that this fails consistently with an empty state):
This is the instance metrics view across all 3 failed runs:
Key take aways
- Each run uses an additional
60GB-90GBof disk space - Having the
.daggermodule cached makes the run10-15%quicker - When running all tests with
-race,GOMAXPROCS 32and no previous state (rm -rf *in/var/run/dockerbefore each run), the tests fail consistently
As discussed with @shykes @samalba & others on August 15, 2024
Activity
jedevc commentedon Aug 20, 2024
note - some of the runtimes of tests may not be accurately reported - see #8120.
gerhard commentedon Aug 20, 2024
This is where I got to today:
test all --race=truewith an empty state (3 failed runs in a row) and not setting any test parallelism (effectivelyGOMAXPROCS 32)25m 35s25m 52s17m 11sThis is what the instance resources looked like during those 3 runs:

I have reworked:
I will appreciate your reviews since in all my manual runs I have confirmed that running
TestModuleseparately from everything else does not fail intermittnetly or timeout if there are sufficient system resources.That PR splits the tests on top of what we have currently. If we confirm that the split makes things more reliable, we should keep all tests together as we investigate that further. I propose that we timebox that activity and pick the reliable and pragmatic solution so that:
mainbecomes greenerMy next step is to finish the remaining runs on the 32vCPU DigitalOcean CPU-optimized instance, and then move onto the matrix with:
TomChv commentedon Aug 20, 2024
Thanks for this amazing issue @gerhard
I think #8185 should also be include to the effort and then spread globally to other test suite.
Moving TypeScript related test from
TestModuleinto its own suites had multiple benefits:I think this is related to #7863 but instead of CI, changes are at the codebase level.
Right now, TypeScript tests takes around 7 minutes to executes https://dagger.cloud/Quartz/traces/a2c3a4a24346f31efac7dc52f23b6137#1fc4089edfc38818 (around 4 minutes setup).
Cool things: tests are run in parallel and successfully pass.
Slowest Typescript tests
Note: Tests are linked to their traces and I only selected tests that are slower than 5m
Note: Theses tests are run locally on my Mac M1 Max (32GB, 500Go NVMI, 16core)
TestInit5m17.It's quite strange because even if these tests are run in parallel, it doesn't seem they start at the same point. The longest sub test in that one took 3m20s so where are the extra 2minutes spent?
Question: is there a limit of the number of tests than can run in parallel?
TestSignaturesBuildinTypes5m24s.This one is also quite strange, if I sum up the time of each steps, I end up with around 3m30s with subtests ([1m24 + 43s + 33s + (12s + 9s + 20s + 10s) ]). so again, where are the extra 2 minutes spent? And in that case, there's no parallelization, so I'm not sure the extra time spent is because of that.
I spotted a typo in the test name btw, will fix it in tests: move TypeScript test to its own suite #8185
TestSignatures5m38s.Same as
TestInit, longest tests is1m46sbut even here if we sum up all tests durations, it's still less than 5 minutes.TestWithOtherModuleTypes7m7s.Strange again here, even the tests are run in parallel (and I verified it by trying to add
t.Parallelbut this ended in an Go error saying it was already parallelized), each of them takes 2m56s. However, the total test time is 7m7s.TestRuntimeDetection5m43s.Still the same issue, tests are all run in parallel and the longest is
1m24s. It's up to 3m30s time spent in that case.Deeper research
If we take as reference
TestRuntimeDetectiontrace (it's the same on all other TS tests, I didn't check for other's languages), we see this:Note: I only included the 2 first tests to keep it short
What's surprising me is that the traces seems to start long after the dagger cli has been started.
If you look closely, there's a gap big gap between the beginning of the session traces and other's tests. Question: Why that gap? Where does it come from? Normally the sum of all trace lenght should be as long as the parent trace?
So we got the step
/.dagger-cli session...that always as long as the test's time, however if we open the trace, we see nothing in. Question: Is it normal?Some hypothesys
It's mostly theory, I'm not 100% sure but hopefully it will be useful to find the answers to our questions
Theses traces highlight that the tests slowness might not be from the tests themselves but from the setup, speciallty the session. As we see in the first session, there is plenty of extra times spent inside the session (however we don't know what's happening there).
So maybe there's a deeper issue with the session setup that creates this slowness, is it because we have so many connection happening in parallel?
It seems there's also some traces or piece of information missing in dagger cloud, is it because of a bug? Is it because these traces are ignored? It might be interested to dig into that too.
Potential things to continue the research
ci: Allow skipping specific tests - e.g. TestModule - or only running…
gerhard commentedon Aug 21, 2024
That's a nice addition @TomChv 💪
As mentioned elsewhere, we cannot trust the test span durations yet. There is a known issue with them, @vito is on it.
In the interim, I have added
-vtogo testpart of #7863 . As this is now merged, if you rebase on top ofmain, you will be able to download the following files from GitHub Actions Artifacts:I then filter for the following:
rg PASS: ~/Downloads/call.log | rg -v 0.00s | less -rvito commentedon Aug 21, 2024
@TomChv
Here's what's happening:
TestRuntimeDetectionruns and likely has ac := connect(ctx)line pretty early on, which is what starts the Dagger session.TestRuntimeDetectionthen callst.Runto create sub-tests. Each of these sub-tests callt.Parallelviatestctxmiddleware, since we want to run all of our tests in parallel.t.Parallelblocks until the Go test runtime tells it to wake up, meaning we hold the Dagger session open this entire time.There are a some potential improvements here:
TestRuntimeDetectionshouldn't be "charged" for the time it spends waiting ont.Parallelin a subtest.Also normal.
dagger sessionno longer shows spans beneath itself - that would "steal" them from their original call paths. For example, if I create a client (dagger.Connect(ctx)), and later on create a spanfoo, and use the client beneath thatfoospan, the telemetry should show up beneathfoo, not beneath the place where we connected to Dagger.sipsma commentedon Aug 21, 2024
Gonna be focusing on this until we reach our goals for CI in terms of de-flaking and test execution time.
I will personally first focus on de-flaking so that we can get our CI consistently green and then hold it to that standard going forward. After that I can join the efforts to improve the performance.
General plan for the test flakes:
TestPythonProjectLayout-The "main" module could not be found#7662 and Tests require disabling go mod index pending upstream bug fix #8031 since they are the most persistent and mysteriousFor the performance aspects, I think the hardest part right now is that the metrics we have are machine wide, which leaves us having to guess or painfully debug what specific parts are performance bottlenecks.
What I'd really like to see is for us to have the ability to gather fine-grain performance profiles in the engine and use those to quickly identify the precise places that are introducing bottlenecks, using excessive CPU/memory/io, etc. There's many possible approaches here which are not mutually exclusive:
One question for you @gerhard: I remember you mentioned that we can now get fine-grain profiles for the CLI. Is there progress on being able to get the same thing for the engine container too? And if not, curious to know if there's any technical problem blockers that we could help with. Having those profiles for the engine could potentially be extremely helpful.
sipsma commentedon Aug 21, 2024
Just chatted with @gerhard who set me up with access to the CI eks cluster, which is going to make the deflaking infinitely simpler since I can go crazy debugging the flakes same as I do when problems are reproducible locally (which most of the remaining flakes are not, unfortunately) 🙏
He also mentioned that the problem with parca integration on the engine is most likely a configuration one as opposed to some deep technical issue, which is great since should be easier to get going. However, with eks access I can also just pprof my way through that for now, which is great in the meantime.
gerhard commentedon Sep 2, 2024
5days &19runs later, we have the first results for:TestModuleinto multiple suites #8212How reliable are the new pipelines?
test-module-runtimes74%test-modules100%test-cli-engine100%test-everything-else79%testdev-module-runtimes85%testdev-container100%How long do these pipelines take to run?
test-module-runtimes7m 40s7m30stest-modules7mtest-cli-engine4m 40stest-everything-else9m 25s9m 5stestdev-module-runtimes9m8m 55stestdev-container7m 20sHow does
test&testdevcompare for reliability?test52%testdev89%How does
test&testdevcompare for duration?test18m 55s30mtestdev9m 35s9m 10sSome additional insights worth sharing:
59%is the success rate before the split fortest&testdevonly71%is the success rate after the split fortest&testdevonlyAttacking those flakes seems to be working! It will be interesting to see if this holds up next week too.
As for the new pipelines which have been split out:
91%is the success rate after the split for all the new pipelinesBefore the split: 5 days from Aug. 24th - Aug. 29th
After the split: 5 days: Aug. 29th - Sep. 3rd
TomChv commentedon Sep 5, 2024
What is the meaning of the
13%in the table? This comment seems to show that it's actually doing better that ever?gerhard commentedon Sep 5, 2024
13%is the Engine & CLI workflow as a whole, which includes both test suites:We are basically running tests twice now, which makes the overall workflow fail more, since there are 2x as many opportunities for flakes to happen.
The key take away is that:
91%successful71%successfulThe most important thing right now is to keep tracking both suites to see if they remain consistently reliably. The problem with
test&testdevis that this has been inconsistent over the various Dagger versions, which is why we now have a different types of suites to track.ci: Move the Engine & CLI split test suites in a separate workflow (#…
sipsma commentedon Sep 20, 2024
Just noting for posterity, ephemeral errors downloading go deps with error messages along the lines of:
protocol error: received DATA before a HEADERS framestream error: stream ID 19; PROTOCOL_ERRORAppear to be golang/go#69544, so not an "us" problem it seems
rajatjindal commentedon Nov 21, 2024
Hi @gerhard
I was reading through this issue, and one of the line item specifically interests me
while having an HTML report for a specific run is great, in my experience what really helps (especially with high flake test repository like ours) is to have trends of these results. In one of my past job I developed a dashboard specifically for this (for a large monolithic app with several days of automated test executions per build) which helped me answer a few questions:
I have been building a similar dashboard as one of my side project (https://github.com/rajatjindal/tests-dashboard) and since last few weeks I occassionally inject test results from our CI into the system to glance through the results. (https://tests-dashboard.rajatjindal.com)
As part of the same effort I opened #9011 to start archiving the test results from our CI as an artifact as the first step. The next step I was thinking was to start injecting these test results into the dashboard and build some analytics out of that.
if that is something that sounds like a useful addition, please let me know. and I can get the basic dashboard setup and ready for consumption quickly.
cc @marcosnils
ci: Merge smaller `Engine & CLI split` jobs into `Engine & CLI` (#8998)
gerhard commentedon Nov 25, 2024
That is an excellent idea @rajatjindal ! I really like this view & I'm keen to visualise these tests through it:
I would very much like us to have this for our own CI. I will take a look at #9011 next.
I was excited to see you using Spin for this. I would be keen to test this on our experimental K8s cluster which has Spin runtime support. Will DM about sync-ing on the next steps.
cc @marcosnils