MCPcopy
hub / github.com/microsoft/retina / TestFailDelete

Function TestFailDelete

pkg/controllers/cache/cache_test.go:343–366  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

341}
342
343func TestFailDelete(t *testing.T) {
344 log.SetupZapLogger(log.GetDefaultLogOpts())
345 ctrl := gomock.NewController(t)
346 defer ctrl.Finish()
347 p := pubsub.NewMockPubSubInterface(ctrl)
348 p.EXPECT().Subscribe(common.PubSubAPIServer, gomock.Any()).Times(1)
349 c := New(p)
350 assert.NotNil(t, c)
351
352 addEndpoints := common.NewRetinaEndpoint("pod1", "ns1", nil)
353
354 // Delete non-existing retina endpoint returns no error.
355 err := c.DeleteRetinaEndpoint(addEndpoints.Key())
356 assert.NoError(t, err)
357
358 svc := common.NewRetinaSvc("svc1", "ns1", nil, nil, nil)
359 err = c.DeleteRetinaSvc(svc.Key())
360 assert.Error(t, err)
361
362 node := common.NewRetinaNode("node1", net.IPv4(1, 2, 3, 4), "zone-1")
363
364 err = c.DeleteRetinaNode(node.Name())
365 assert.Error(t, err)
366}
367
368func TestCachingNamespace(t *testing.T) {
369 log.SetupZapLogger(log.GetDefaultLogOpts())

Callers

nothing calls this directly

Calls 15

EXPECTMethod · 0.95
NameMethod · 0.95
SetupZapLoggerFunction · 0.92
GetDefaultLogOptsFunction · 0.92
NewMockPubSubInterfaceFunction · 0.92
NewRetinaEndpointFunction · 0.92
NewRetinaSvcFunction · 0.92
NewRetinaNodeFunction · 0.92
KeyMethod · 0.80
NewFunction · 0.70
SubscribeMethod · 0.65
DeleteRetinaEndpointMethod · 0.65

Tested by

no test coverage detected