Skip to content

ci: Add extra flags for Engine & CLI tests - #7416

Merged
gerhard merged 2 commits into
dagger:mainfrom
gerhard:add-extra-flags-to-engine-and-cli-tests
May 22, 2024
Merged

gerhard merged 2 commits into
dagger:mainfrom
gerhard:add-extra-flags-to-engine-and-cli-tests

Conversation

@gerhard

@gerhard gerhard commented May 20, 2024 •

Copy link
Copy Markdown
Contributor

--parallel now defaults to the number of CPUs. Before, this was hard-coded to 16 which was set the number of CPUs in the larger GitHub Runners, the ubuntu-22.04-16c-64g-600gb instance size specifically. We still want 16 in CI - we set this explicitly in the GitHub workflows - but are likely to want less locally where some of us only have 8 or 10 CPUs.

--timeout defaults to 30m. This was changed not that long ago - the value was set to 1h when using race. The bottom line is that none of our test suites should take more than 10 minutes. This is something that we are actively working towards. For now, until the pipeline becomes more reliable, we will stick with the current 30m default. When running locally with fewer CPUs, or when hunting deadlocks, experience recommends a value of 180m.

--failfast is a new one. It sets --max-fails=1 in gotestsum. FTR:
https://github.com/gotestyourself/gotestsum/blob/e9677fb405a5c0dc0b9d7217a7c73c3a20c5cb66/cmd/testdata/gotestsum-help-text#L20


Part of:

FWIW, I am using the following shell function with this change:

dagger-test-all() {
        local parallel="${1:-16}"
        local timeout="${2:-180m}"
        time dagger call --debug --source=".:default" test all --race=true --failfast=true --parallel=$parallel --timeout=$timeout 2>&1 | ts | tee test.all.race.failfast.parallel${parallel}.timeout${timeout}.$(date "+%Y-%m-%d.%H-%M-%S").txt
}

@jedevc

jedevc commented May 20, 2024

Copy link
Copy Markdown
Contributor

I'm not sure we should set failfast by default - this is very helpful when making large refactorings, and trying to observe all the genuine failures. It's annoying in the case of flakes, or going for a fully green run, but getting all the failures is genuinely useful a lot of the time in my experience.

Comment thread ci/test.go Outdated
Comment on lines 107 to 112

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.

We should use // +default for this one.

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.

If we did this, we would have the default in 3 places:

  1. All()
  2. Important()
  3. Custom()

Since the race flag uses the same approach - default in code rather than // +default - I think that we should leave this as is. WDYT?

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.

Hm, alternatively, we should refactor all of these into one function - then which tests to run should probably be flags on in.

Not a blocker though, happy as is.

@gerhard

gerhard commented May 20, 2024

Copy link
Copy Markdown
Contributor Author

@jedevc I'm not sure we should set failfast by default - this is very helpful when making large refactorings, and trying to observe all the genuine failures.

Makes sense. Changing the default to false.

Gerhard Lazu added 2 commits May 20, 2024 15:10
`--parallel` now defaults to the number of CPUs. Before, this was
hard-coded to `16` which was set the number of CPUs in the larger GitHub
Runners, the `ubuntu-22.04-16c-64g-600gb` instance size specifically. If
this new default value does not work well on the larger CI runners (they
have 48CPUs & we run multiple pipelines on them at the same time), we
can specify this value explicitly in the workflows.

`--timeout` defaults to `30m`. This was changed not that long ago - the
value was set to 1h when using race. The bottom line is that none of our
test suites should take more than 10 minutes. This is something that we
are actively working towards. For now, until the pipeline becomes more
reliable, we will stick with the current 30m default. When running
locally with fewer CPUs, or when hunting deadlocks, experience
recommends a value of 180m.

`--failfast` is a new one. It sets `--max-fails=1` in `gotestsum`. FTR:
https://github.com/gotestyourself/gotestsum/blob/e9677fb405a5c0dc0b9d7217a7c73c3a20c5cb66/cmd/testdata/gotestsum-help-text#L20

Signed-off-by: Gerhard Lazu <[email protected]>
Comment thread ci/test.go Outdated
Comment on lines 107 to 112

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.

Hm, alternatively, we should refactor all of these into one function - then which tests to run should probably be flags on in.

Not a blocker though, happy as is.

secrets: inherit
with:
function: test all --race=true
function: test all --race=true --parallel=16

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.

Is this different from NumCPUs? I think we can leave this unset.

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.

Yes, we are explicitly setting this to 16 in CI.

The new CI runners usually have 48 and even 64 CPUs which makes tests fail. Before setting this, checks failed.

@gerhard

gerhard commented May 22, 2024

Copy link
Copy Markdown
Contributor Author

Going to merge this since the failing check is due to:

The check is currently showing as failing:
image

But the last run - attempt #3 - succeeded 🤷‍♂️
image

@gerhard
gerhard merged commit f1cbd7c into dagger:main May 22, 2024
@gerhard
gerhard deleted the add-extra-flags-to-engine-and-cli-tests branch May 22, 2024 13:15
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.

2 participants