MCPcopy
hub / github.com/hashicorp/packer / TestBuildParallel_Timeout

Function TestBuildParallel_Timeout

command/build_parallel_test.go:150–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

148}
149
150func TestBuildParallel_Timeout(t *testing.T) {
151 // testfile has 6 builds, 1 of them locks 'forever', one locks and times
152 // out other builds should go through.
153 b := NewParallelTestBuilder(4)
154 locked := &LockedBuilder{unlock: make(chan interface{})}
155
156 c := &BuildCommand{
157 Meta: testMetaParallel(t, b, locked),
158 }
159
160 args := []string{
161 "-parallel-builds=3",
162 filepath.Join(testFixture("parallel"), "2lock-timeout.json"),
163 }
164
165 wg := errgroup.Group{}
166
167 wg.Go(func() error {
168 if code := c.Run(args); code == 0 {
169 fatalCommand(t, c.Meta)
170 }
171 return nil
172 })
173
174 b.wg.Wait() // ran 4 times
175 close(locked.unlock) // unlock locking one
176 wg.Wait() // wait for termination
177}

Callers

nothing calls this directly

Calls 5

RunMethod · 0.95
NewParallelTestBuilderFunction · 0.85
testMetaParallelFunction · 0.85
testFixtureFunction · 0.85
fatalCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…