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

Function testRandomObjects

pkg/entity/entity_test.go:208–226  ·  view source on GitHub ↗

testRandomObjects returns a slice of randomly generated objects. If it is called with an object count of 0, a random number of slices (with an upper bound of 100) will be generated.

(num int)

Source from the content-addressed store, hash-verified

206// testRandomObjects returns a slice of randomly generated objects. If it is called with an object
207// count of 0, a random number of slices (with an upper bound of 100) will be generated.
208func testRandomObjects(num int) (objects []deploy.KubeObject) {
209 if num == 0 {
210 num = rand.Intn(100)
211 }
212
213 for i := 0; i < num; i++ {
214 // TODO: create different types of objects
215 name := ""
216 for {
217 name = randomString(10)
218 if !TestUsedNames[name] {
219 break
220 }
221 }
222 TestUsedNames[name] = true
223 objects = append(objects, createSecret(name))
224 }
225 return
226}
227
228func testDeploymentEqual(t *testing.T, expected, actual *deploy.Deployment) bool {
229 equal := expected.Equal(actual)

Callers 7

TestImageAttachFunction · 0.70
TestAppAttachImageFunction · 0.70
TestPodAttachImageFunction · 0.70
TestPodAttachContainerFunction · 0.70
TestRCAttachImageFunction · 0.70
TestRCAttachContainerFunction · 0.70
TestRCAttachPodFunction · 0.70

Calls 2

randomStringFunction · 0.70
createSecretFunction · 0.70

Tested by

no test coverage detected