Merge pull request #12368 from hashicorp/b-gosched
terraform: run Gosched in test so other goroutines run
This commit is contained in:
commit
7c45e57f6b
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -1812,7 +1813,9 @@ func TestContext2Apply_cancelBlock(t *testing.T) {
|
||||||
close(applyCh)
|
close(applyCh)
|
||||||
|
|
||||||
for !ctx.sh.Stopped() {
|
for !ctx.sh.Stopped() {
|
||||||
// Wait for stop to be called
|
// Wait for stop to be called. We call Gosched here so that
|
||||||
|
// the other goroutines can always be scheduled to set Stopped.
|
||||||
|
runtime.Gosched()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sleep
|
// Sleep
|
||||||
|
|
Loading…
Reference in New Issue