mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Query consul without helpers in test to be safe
This commit is contained in:
@@ -147,12 +147,25 @@ func TestConsulServiceRegisterServices(t *testing.T) {
|
||||
t.Fatalf("expected 0 checks but found %d", numchecks)
|
||||
}
|
||||
|
||||
agentServices, err := cs.queryAgentServices()
|
||||
// Assert services are in consul
|
||||
agentServices, err := cs.client.Agent().Services()
|
||||
if err != nil {
|
||||
t.Fatalf("error querying consul services: %v", err)
|
||||
}
|
||||
if len(agentServices) != numservices {
|
||||
t.Fatalf("expected %d services in consul but found %d:\n%#v", numservices, len(agentServices), agentServices)
|
||||
found := 0
|
||||
for id, as := range agentServices {
|
||||
if id == "consul" {
|
||||
found++
|
||||
continue
|
||||
}
|
||||
if _, ok := services[ServiceKey(as.Service)]; ok {
|
||||
found++
|
||||
continue
|
||||
}
|
||||
t.Errorf("unexpected service in consul: %s", id)
|
||||
}
|
||||
if found != 3 {
|
||||
t.Fatalf("expected 3 services in consul but found %d:\nconsul: %#v", len(agentServices), agentServices)
|
||||
}
|
||||
|
||||
agentChecks, err := cs.queryChecks()
|
||||
|
||||
Reference in New Issue
Block a user