-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Terraform test: Execute eligible test runs in parallel #36300
Conversation
38f192d
to
3f8ae6e
Compare
3f8ae6e
to
f2201ea
Compare
f2201ea
to
754bc4e
Compare
d71ee5e
to
6871a7d
Compare
eeeb05b
to
e94cd79
Compare
e94cd79
to
554af21
Compare
e3dbde7
to
861afba
Compare
85d0528
to
974272d
Compare
36227ed
to
9bce19f
Compare
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.
Nice, looks good - just one question about the ordering of execution vs cancellations.
internal/backend/local/test.go
Outdated
if runner.Suite.Stopped { | ||
// Then the test was requested to be stopped, so we just mark each | ||
// following test as skipped, print the status, and move on. | ||
run.Status = moduletest.Skip | ||
runner.Suite.View.Run(run, file, moduletest.Complete, 0) | ||
continue | ||
return | ||
} | ||
|
||
file.Lock() | ||
if file.Status == moduletest.Error { | ||
// If the overall test file has errored, we don't keep trying to | ||
// execute tests. Instead, we mark all remaining run blocks as | ||
// skipped, print the status, and move on. | ||
run.Status = moduletest.Skip | ||
runner.Suite.View.Run(run, file, moduletest.Complete, 0) | ||
continue | ||
file.Unlock() | ||
return | ||
} | ||
file.Unlock() |
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.
should we move this above the .Execute()
calls above? Just so we check if we should execute before we do any of the work?
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.
Sure. It was only okay to do this because most of the execution is still done in this file, but that may change in future, so will move 👍
=> 9555a29
28e93e4
to
74e4d8d
Compare
74e4d8d
to
9555a29
Compare
Fixes #34180
This PR introduces a graph-based execution model into the terraform test framework. With this model, test runs are able to execute in parallel. However, the rules for executing 2 runs in parallel must be fulfilled. Both runs must not share the same state, and there must be no interdependency between them.
The PR also introduces a new "test" block to test files. The block can be used to annotate the file's runs as candidates for parallelism. Each individual run block can however also set this attribute.
For now, the execution of a test run is split between the
Execute
method of the NodeTestRun, and the graph walk callback itself. Eventually, all logic should be moved into theExecute
method.Target Release
1.11.x
CHANGELOG entry