Skip to content

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 21, 2025

Note: this commit was partially authored by AI.

  • Replaces coderdtest.CreateTemplate/TemplateVersion() with direct dbgen calls. We do not need a fully functional template for these tests.
  • Removes provisioner daemon creation/cleanup. We do not need a running provisioner daemon here; this functionality is tested elsewhere.
  • Simplifies provisioner job creation test helpers.

This reduces the test runtime by over 50%:

Old:

time go test -count=100 ./cli -test.run=TestProvisionerJobs
ok      github.com/coder/coder/v2/cli   50.149s

New:

time go test -count=100 ./cli -test.run=TestProvisionerJobs
ok      github.com/coder/coder/v2/cli   21.898

@johnstcn johnstcn requested a review from mafredri August 21, 2025 16:49
@johnstcn johnstcn self-assigned this Aug 21, 2025
@johnstcn johnstcn force-pushed the cj/cli-testprovisionerjobs-speedup branch from 7cd2af7 to 3fb9788 Compare August 22, 2025 11:26
@@ -112,12 +88,14 @@ func TestProvisionerJobs(t *testing.T) {
return job
}

prepareTemplateVersionImportJobBuilder := func(t *testing.T, dryRun bool) database.ProvisionerJob {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: it's simpler to have separate test helpers instead of one with a control flag.

@johnstcn johnstcn requested a review from mafredri August 22, 2025 12:35
@johnstcn johnstcn merged commit 5e49d8c into main Aug 22, 2025
31 of 32 checks passed
@johnstcn johnstcn deleted the cj/cli-testprovisionerjobs-speedup branch August 22, 2025 12:40
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants