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

Function TestBuildParallel_2

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

Source from the content-addressed store, hash-verified

119}
120
121func TestBuildParallel_2(t *testing.T) {
122 // testfile has 6 builds, 2 of them lock 'forever', other builds
123 // should go through.
124 b := NewParallelTestBuilder(4)
125 locked := &LockedBuilder{unlock: make(chan interface{})}
126
127 c := &BuildCommand{
128 Meta: testMetaParallel(t, b, locked),
129 }
130
131 args := []string{
132 "-parallel-builds=3",
133 filepath.Join(testFixture("parallel"), "2lock-4wg.json"),
134 }
135
136 wg := errgroup.Group{}
137
138 wg.Go(func() error {
139 if code := c.Run(args); code != 0 {
140 fatalCommand(t, c.Meta)
141 }
142 return nil
143 })
144
145 b.wg.Wait() // ran 4 times
146 close(locked.unlock) // unlock locking one
147 wg.Wait() // wait for termination
148}
149
150func TestBuildParallel_Timeout(t *testing.T) {
151 // testfile has 6 builds, 1 of them locks 'forever', one locks and times

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…