Skip to content

Commit

Permalink
add test for resilient single
Browse files Browse the repository at this point in the history
  • Loading branch information
ObiWahn committed Mar 23, 2018
1 parent 6081d4f commit 2d22c41
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/deployments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func TestDeploymentSingleRocksDB(t *testing.T) {
deploymentSubTest(t, api.DeploymentModeSingle, api.StorageEngineRocksDB)
}

func TestDeploymentResilientSingleMMFiles(t *testing.T) {
deploymentSubTest(t, api.DeploymentModeResilientSingle, api.StorageEngineMMFiles)
}

func TestDeploymentResilientSingleRocksDB(t *testing.T) {
deploymentSubTest(t, api.DeploymentModeResilientSingle, api.StorageEngineRocksDB)
}

func TestDeploymentClusterMMFiles(t *testing.T) {
deploymentSubTest(t, api.DeploymentModeCluster, api.StorageEngineMMFiles)
}
Expand Down Expand Up @@ -92,6 +100,40 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
if err := waitUntilVersionUp(DBClient); err != nil {
t.Fatalf("Single Server not running in time: %v", err)
}
} else if deployment.Spec.Mode == api.DeploymentModeResilientSingle {
if err := waitUntilVersionUp(DBClient); err != nil {
t.Fatalf("Single Server not running in time: %v", err)
}

// FIXME - waitUntilResilientHealth

members := deployment.Status.Members

singles := members.Single
agents := members.Agents
servers := append(append(api.MemberStatusList{}, singles...), agents...)

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

// FIXME - run api/version for all servers
// - create dbconnection to each of the servers
// - run api version on connection

t.Fatal("This test is not fully implemented!")

// TEST CODE BELOW
t.Log("##################################")
if len(agents) == 0 {
t.Fatal("This setup requires agents to work!")
}

t.Logf("agents len: %v", len(agents))
for _, server := range servers {
t.Logf("Server: %v ", server)
}
t.Log("##################################")
} else {
t.Fatalf("DeploymentMode %v is not supported!", deployment.Spec.Mode)
}
Expand Down

0 comments on commit 2d22c41

Please sign in to comment.