MCPcopy
hub / github.com/cloudflare/cloudflared / TestManagerAddAndRemove

Function TestManagerAddAndRemove

overwatch/manager_test.go:41–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestManagerAddAndRemove(t *testing.T) {
42 m := NewAppManager(nil)
43
44 first := &mockService{serviceName: "first", serviceType: "mock"}
45 second := &mockService{serviceName: "second", serviceType: "mock"}
46 m.Add(first)
47 m.Add(second)
48 assert.Len(t, m.Services(), 2, "expected 2 services in the list")
49
50 m.Remove(first.Name())
51 services := m.Services()
52 assert.Len(t, services, 1, "expected 1 service in the list")
53 assert.Equal(t, second.Hash(), services[0].Hash(), "hashes should match. Wrong service was removed")
54}
55
56func TestManagerDuplicate(t *testing.T) {
57 m := NewAppManager(nil)

Callers

nothing calls this directly

Calls 9

AddMethod · 0.95
ServicesMethod · 0.95
RemoveMethod · 0.95
NameMethod · 0.95
HashMethod · 0.95
NewAppManagerFunction · 0.85
LenMethod · 0.80
EqualMethod · 0.65
HashMethod · 0.65

Tested by

no test coverage detected