Verify that consul service is registered

This commit is contained in:
Armon Dadgar 2014-01-09 18:02:44 -08:00
parent 5c6596fa8a
commit 0507568a37
1 changed files with 13 additions and 1 deletions

View File

@ -30,7 +30,7 @@ func TestLeader_RegisterMember(t *testing.T) {
// Wait for registration
time.Sleep(10 * time.Millisecond)
// Should be registered
// Client should be registered
state := s1.fsm.State()
found, _ := state.GetNode(c1.config.NodeName)
if !found {
@ -51,6 +51,18 @@ func TestLeader_RegisterMember(t *testing.T) {
if checks[0].Status != structs.HealthPassing {
t.Fatalf("bad check: %v", checks[0])
}
// Server should be registered
found, _ = state.GetNode(s1.config.NodeName)
if !found {
t.Fatalf("server not registered")
}
// Service should be registered
services := state.NodeServices(s1.config.NodeName)
if _, ok := services.Services["consul"]; !ok {
t.Fatalf("consul service not registered: %v", services)
}
}
func TestLeader_FailedMember(t *testing.T) {