MCPcopy
hub / github.com/redspread/spread / testWriteAndAttachRandomContainers

Function testWriteAndAttachRandomContainers

pkg/input/dir/input_test.go:157–176  ·  view source on GitHub ↗
(t *testing.T, num int, dir string, parent entity.Entity)

Source from the content-addressed store, hash-verified

155}
156
157func testWriteAndAttachRandomContainers(t *testing.T, num int, dir string, parent entity.Entity) {
158 for i := 0; i < num; i++ {
159 name := randomString(8)
160
161 kubeContainer := kube.Container{
162 Name: name,
163 Image: randomString(6),
164 ImagePullPolicy: kube.PullAlways,
165 TerminationMessagePath: kube.TerminationMessagePathDefault,
166 }
167 filename := path.Join(dir, name+ContainerExtension)
168
169 container, err := entity.NewContainer(kubeContainer, kube.ObjectMeta{}, filename)
170 assert.NoError(t, err)
171
172 testWriteYAMLToFile(t, filename, &kubeContainer)
173
174 assert.NoError(t, parent.Attach(container), "should be able to attach container to pod")
175 }
176}

Callers

nothing calls this directly

Calls 3

testWriteYAMLToFileFunction · 0.85
randomStringFunction · 0.70
AttachMethod · 0.65

Tested by

no test coverage detected