terraform: acquireRun during test to avoid special case logic
This commit is contained in:
parent
5b42781117
commit
00232f0994
|
@ -907,13 +907,10 @@ func (c *Context) walk(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) watchStop(walker *ContextGraphWalker, doneCh <-chan struct{}) {
|
func (c *Context) watchStop(walker *ContextGraphWalker, doneCh <-chan struct{}) {
|
||||||
// Get the stop channel. runContext might be nil only during tests.
|
// Get the stop channel. runContext will never be nil since this should
|
||||||
// If this is called during a proper run operation, this will never
|
// only be called within the context of an operation started with
|
||||||
// be nil.
|
// acquireRun
|
||||||
var stopCh <-chan struct{}
|
stopCh := c.runContext.Done()
|
||||||
if ctx := c.runContext; ctx != nil {
|
|
||||||
stopCh = ctx.Done()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for a stop or completion
|
// Wait for a stop or completion
|
||||||
select {
|
select {
|
||||||
|
|
|
@ -906,6 +906,7 @@ func TestContext2Validate_PlanGraphBuilder(t *testing.T) {
|
||||||
Targets: c.targets,
|
Targets: c.targets,
|
||||||
}).Build(RootModulePath)
|
}).Build(RootModulePath)
|
||||||
|
|
||||||
|
defer c.acquireRun("validate-test")()
|
||||||
walker, err := c.walk(graph, graph, walkValidate)
|
walker, err := c.walk(graph, graph, walkValidate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue