(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestNewReverseProxy(t *testing.T) { |
| 179 | proxy := newReverseProxy(&goodCfg.ConnectionPool) |
| 180 | if err := proxy.applyConfig(goodCfg); err != nil { |
| 181 | t.Fatalf("error while loading config: %s", err) |
| 182 | } |
| 183 | if len(proxy.clusters) != 1 { |
| 184 | t.Fatalf("got %d hosts; expResponse: %d", len(proxy.clusters), 1) |
| 185 | } |
| 186 | c := proxy.clusters["cluster"] |
| 187 | r := c.replicas[0] |
| 188 | if len(r.hosts) != 1 { |
| 189 | t.Fatalf("got %d hosts; expResponse: %d", len(r.hosts), 1) |
| 190 | } |
| 191 | if r.hosts[0].Host() != "localhost:8123" { |
| 192 | t.Fatalf("got %s host; expResponse: %s", r.hosts[0].Host(), "localhost:8123") |
| 193 | } |
| 194 | if len(proxy.users) != 1 { |
| 195 | t.Fatalf("got %d users; expResponse: %d", len(proxy.users), 1) |
| 196 | } |
| 197 | if _, ok := proxy.users[defaultUsername]; !ok { |
| 198 | t.Fatalf("expected user %q to be present in users", defaultUsername) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | var badCfg = &config.Config{ |
| 203 | Clusters: []config.Cluster{ |
nothing calls this directly
no test coverage detected