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

Function testWriteRandomObjects

pkg/input/dir/input_test.go:109–127  ·  view source on GitHub ↗

testWriteRandomObjects randomly generates Kubernetes objects and writes them in the specified path. The created objects are returned with Type information clean. If object count is < 0, a random number will be used.

(t *testing.T, dir string, count int)

Source from the content-addressed store, hash-verified

107// testWriteRandomObjects randomly generates Kubernetes objects and writes them in the specified path.
108// The created objects are returned with Type information clean. If object count is < 0, a random number will be used.
109func testWriteRandomObjects(t *testing.T, dir string, count int) []deploy.KubeObject {
110 objects := testRandomObjects(count)
111
112 kubeDir := path.Join(dir, ObjectsDir)
113 err := os.Mkdir(kubeDir, TestFilePerms)
114 if err != nil {
115 t.Fatal(err)
116 }
117
118 for _, obj := range objects {
119 filename := path.Join(kubeDir, obj.GetObjectMeta().GetName()+".yml")
120 testWriteYAMLToFile(t, filename, obj)
121
122 // cleanup type information which is removed from decoded objects
123 testClearTypeInfo(obj)
124 }
125
126 return objects
127}
128
129func testKubePod() *kube.Pod {
130 terminationPeriod := int64(30)

Callers 2

TestInputPodFunction · 0.85
TestInputRCAndPodFunction · 0.85

Calls 3

testWriteYAMLToFileFunction · 0.85
testClearTypeInfoFunction · 0.85
testRandomObjectsFunction · 0.70

Tested by

no test coverage detected