Skip to content

Commit

Permalink
add CreateArangodClient and version up check
Browse files Browse the repository at this point in the history
  • Loading branch information
ObiWahn committed Mar 25, 2018
1 parent c0b8b5c commit c19ec38
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions tests/deployments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import (
"testing"

"github.com/dchest/uniuri"
//cg "k8s.io/client-go"

driver "github.com/arangodb/go-driver"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
kubeArangoClient "github.com/arangodb/kube-arangodb/pkg/client"
arangod "github.com/arangodb/kube-arangodb/pkg/util/arangod"
)

// environements: provided from outside
Expand Down Expand Up @@ -106,34 +108,28 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
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(singles), 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!")
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)
}
waitUntilVersionUp(dbclient)
}

t.Logf("agents len: %v", len(agents))
for _, server := range servers {
t.Logf("Server: %v ", server)
for _, single := range singles {
dbclient, err := arangod.CreateArangodClient(ctx, k8sClient.CoreV1(), deployment, api.ServerGroupAgents, single.ID)
if err != nil {
t.Fatal("Unable to create connection to: %v", single.ID)
}
waitUntilVersionUp(dbclient)
}
t.Log("##################################")
} else {
t.Fatalf("DeploymentMode %v is not supported!", deployment.Spec.Mode)
}
Expand Down

0 comments on commit c19ec38

Please sign in to comment.