-
Notifications
You must be signed in to change notification settings - Fork 956
fix: don't create autostart workspace builds with no available provisioners #19067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
provisioner is not available Signed-off-by: Callum Styan <callumstyan@gmail.com>
transition so that we don't accumulate autostart jobs that will eventually have to be cleaned up by the reaper routine Signed-off-by: Callum Styan <callumstyan@gmail.com>
DB/provisioner to be available, so add a way to skip the check Signed-off-by: Callum Styan <callumstyan@gmail.com>
} | ||
|
||
// Check if any provisioners are active (not stale) | ||
now := dbtime.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be using the passed in time from runOnce
rather than getting it's own time
if testing.Testing() { | ||
staleInterval = TestingStaleInterval | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use the passed in time from runOnce
I don't think changing the interval would be necessary, you could write the test in a way that the default interval works fine
@@ -52,6 +56,9 @@ type Executor struct { | |||
experiments codersdk.Experiments | |||
|
|||
metrics executorMetrics | |||
|
|||
// Skip provisioner availability check (should only be true for *some* tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It says it should only be true for some tests, but it seems it's true for almost every test using coderdtest
. How many tests are actually broken by this change? If it's only a few, I'd rather we just fix those tests (e.g. by adding provisioners) rather than add a skip flag.
This should fix #17941
With just the test addition the test will fail since the workspace build is triggered, we attempt to move the workspace into the
start
state:require.Equal(t, codersdk.WorkspaceTransitionStop, workspace.LatestBuild.Transition)
With the 2nd commit we skip the calls to
wsbuilder.New
andbuilder.Build
and so the transition is never scheduled.However, many tests don't fully setup provisioner or wait for the provisioner + DB to be fully available, so the third commit adds a somewhat smelly way to skip the provisioner check in tests that don't need to test that functionality.