(t *testing.T)
| 191 | } |
| 192 | |
| 193 | func 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 | |
| 226 | func TestExpandFWMServices(t *testing.T) { |
| 227 | vserver := newTestVserver(nil) |
nothing calls this directly
no test coverage detected