@@ -25,9 +25,7 @@ import (
2525)
2626
2727var (
28- resourcePod = schema.GroupVersionResource {Group : "" , Version : "v1" , Resource : "pods" }
29- resourceNetworkNeighborhood = schema.GroupVersionResource {Group : "spdx.softwarecomposition.kubescape.io" , Version : "v1beta1" , Resource : "networkneighborhoods" }
30- resourceApplicationProfile = schema.GroupVersionResource {Group : "spdx.softwarecomposition.kubescape.io" , Version : "v1beta1" , Resource : "applicationprofiles" }
28+ resourcePod = schema.GroupVersionResource {Group : "" , Version : "v1" , Resource : "pods" }
3129)
3230
3331func init () {
@@ -207,113 +205,11 @@ func getKey(obj runtime.Object) string {
207205
208206func TestStart_1 (t * testing.T ) {
209207 tt := []testObj {
210- {
211- name : "list ApplicationProfiles" ,
212- resources : []schema.GroupVersionResource {resourceApplicationProfile },
213- preCreatedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection )},
214- },
215- {
216- name : "list NetworkNeighborhoods" ,
217- resources : []schema.GroupVersionResource {resourceNetworkNeighborhood },
218- preCreatedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindNN , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestCollection )},
219- },
220208 {
221209 name : "watch Pods" ,
222210 resources : []schema.GroupVersionResource {resourcePod },
223211 createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindPod , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestCollection )},
224212 },
225- {
226- name : "watch ApplicationProfiles" ,
227- resources : []schema.GroupVersionResource {resourceApplicationProfile },
228- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection )},
229- },
230- {
231- name : "watch NetworkNeighborhoods" ,
232- resources : []schema.GroupVersionResource {resourceNetworkNeighborhood },
233- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindNN , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestCollection )},
234- },
235- }
236-
237- for _ , tc := range tt {
238- t .Run (tc .name , func (t * testing.T ) {
239- startTest (t , tc )
240- })
241- }
242- }
243-
244- func TestStart_2 (t * testing.T ) {
245- tt := []testObj {
246- {
247- name : "list and modify" ,
248- resources : []schema.GroupVersionResource {resourceApplicationProfile },
249- preCreatedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
250- modifiedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
251- },
252- {
253- name : "watch and modify" ,
254- resources : []schema.GroupVersionResource {resourceApplicationProfile },
255- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
256- modifiedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
257- },
258- }
259-
260- for _ , tc := range tt {
261- t .Run (tc .name , func (t * testing.T ) {
262- startTest (t , tc )
263- })
264- }
265- }
266-
267- func TestStart_3 (t * testing.T ) {
268- tt := []testObj {
269-
270- {
271- name : "list and watch" ,
272- resources : []schema.GroupVersionResource {resourceApplicationProfile },
273- preCreatedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection )},
274- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
275- },
276- {
277- name : "list and delete" ,
278- resources : []schema.GroupVersionResource {resourceApplicationProfile },
279- preCreatedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
280- deleteObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
281- },
282- }
283-
284- for _ , tc := range tt {
285- t .Run (tc .name , func (t * testing.T ) {
286- startTest (t , tc )
287- })
288- }
289- }
290- func TestStart_4 (t * testing.T ) {
291- tt := []testObj {
292- {
293- name : "watch, modify, and delete" ,
294- resources : []schema.GroupVersionResource {resourceApplicationProfile },
295- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
296- modifiedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
297- deleteObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx )},
298- },
299- }
300-
301- for _ , tc := range tt {
302- t .Run (tc .name , func (t * testing.T ) {
303- startTest (t , tc )
304- })
305- }
306- }
307-
308- func TestStart_5 (t * testing.T ) {
309- tt := []testObj {
310- {
311- name : "multi watch, modify, and delete" ,
312- resources : []schema.GroupVersionResource {resourceApplicationProfile , resourceNetworkNeighborhood , resourcePod },
313- createObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestCollection )},
314- modifiedObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestCollection )},
315- deleteObjects : []runtime.Object {mocks .GetRuntime (mocks .TestKindAP , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindAP , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindNN , mocks .TestCollection ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestNginx ), mocks .GetRuntime (mocks .TestKindPod , mocks .TestCollection )},
316- },
317213 }
318214
319215 for _ , tc := range tt {
0 commit comments