MCPcopy
hub / github.com/google/seesaw / TestExpandServices

Function TestExpandServices

engine/vserver_test.go:193–224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

191}
192
193func TestExpandServices(t *testing.T) {
194 vserver := newTestVserver(nil)
195 vserver.config = &vserverConfig
196 svcs := vserver.expandServices()
197 if len(svcs) != len(expectedServices) {
198 t.Errorf("Expected %d services, got %d",
199 len(expectedServices), len(svcs))
200 return
201 }
202 for sk, s := range svcs {
203 es, ok := expectedServices[sk]
204 if !ok {
205 t.Errorf("Failed to find service - %#v", sk)
206 continue
207 }
208 if !s.ip.Equal(es.ip) {
209 t.Errorf("Service failed to match - got %v, want %v",
210 s.ip, es.ip)
211 }
212 dsts := vserver.expandDests(s)
213 if len(dsts) != len(es.expectedDests) {
214 t.Errorf("Expected %d destinations, got %d",
215 len(es.expectedDests), len(dsts))
216 continue
217 }
218 for _, ed := range es.expectedDests {
219 if dsts[ed.destinationKey] == nil {
220 t.Errorf("Failed to find dest - %v", ed.ip)
221 }
222 }
223 }
224}
225
226func TestExpandFWMServices(t *testing.T) {
227 vserver := newTestVserver(nil)

Callers

nothing calls this directly

Calls 4

newTestVserverFunction · 0.85
expandServicesMethod · 0.80
expandDestsMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected