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

Function TestSourceEntitiesEmptyFile

pkg/input/dir/source_test.go:120–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestSourceEntitiesEmptyFile(t *testing.T) {
121 fs := testTempFileSource(t)
122 defer os.RemoveAll(string(fs))
123
124 entityFiles := []string{
125 path.Join(string(fs), "dogan.rc.yml"),
126 path.Join(string(fs), "hampshire.pod.json"),
127 }
128
129 // create files
130 for _, file := range entityFiles {
131 _, err := os.Create(file)
132 if err != nil {
133 t.Fatal(err)
134 }
135 }
136
137 rcs, err := fs.Entities(entity.EntityReplicationController)
138 assert.NoError(t, err, "should be okay")
139 assert.Len(t, rcs, 0, "should not have any rcs")
140
141 pods, err := fs.Entities(entity.EntityPod)
142 assert.NoError(t, err, "should be okay")
143 assert.Len(t, pods, 0, "should not have any pods")
144
145 containers, err := fs.Entities(entity.EntityContainer)
146 assert.NoError(t, err, "should be okay")
147 assert.Len(t, containers, 0, "should not have any containers")
148
149 images, err := fs.Entities(entity.EntityImage)
150 assert.NoError(t, err, "should be okay")
151 assert.Len(t, images, 0, "should not have any images")
152}
153
154func TestSourceRCs(t *testing.T) {
155 fs := testTempFileSource(t)

Callers

nothing calls this directly

Calls 3

testTempFileSourceFunction · 0.85
EntitiesMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected