Skip to content

Commit

Permalink
Fixed resilientsingle deployment tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoutp committed Mar 26, 2018
1 parent e7bf5e7 commit 05fca79
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/deployments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,38 +119,38 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
agents := members.Agents

if len(singles) != 2 || len(agents) != 3 {
t.Fatal("Wrong number of servers: single %v - agents %v", len(singles), len(agents))
t.Fatalf("Wrong number of servers: single %d - agents %d", len(singles), len(agents))
}

for _, agent := range agents {
dbclient, err := arangod.CreateArangodClient(ctx, k8sClient.CoreV1(), deployment, api.ServerGroupAgents, agent.ID)
if err != nil {
t.Fatal("Unable to create connection to: %v", agent.ID)
t.Fatalf("Unable to create connection to: %s", agent.ID)
}

if err := waitUntilVersionUp(dbclient); err != nil {
t.Fatal("Version check failed for: %v", agent.ID)
t.Fatalf("Version check failed for: %s", agent.ID)
}
}

var goodResults, noLeaderResults int
for _, single := range singles {
dbclient, err := arangod.CreateArangodClient(ctx, k8sClient.CoreV1(), deployment, api.ServerGroupAgents, single.ID)
dbclient, err := arangod.CreateArangodClient(ctx, k8sClient.CoreV1(), deployment, api.ServerGroupSingle, single.ID)
if err != nil {
t.Fatal("Unable to create connection to: %v", single.ID)
t.Fatalf("Unable to create connection to: %s", single.ID)
}

if err := waitUntilVersionUp(dbclient, true); err == nil {
goodResults++
} else if driver.IsNoLeader(err) {
noLeaderResults++
} else {
t.Fatal("Version check failed for: %v", single.ID)
t.Fatalf("Version check failed for: %s", single.ID)
}
}

if goodResults < 1 || noLeaderResults > 1 {
t.Fatal("Wrong number of results: good %v - noleader %v", goodResults, noLeaderResults)
t.Fatalf("Wrong number of results: good %d - noleader %d", goodResults, noLeaderResults)
}
default:
t.Fatalf("DeploymentMode %v is not supported!", mode)
Expand Down

0 comments on commit 05fca79

Please sign in to comment.