Skip to content

Commit

Permalink
wait more for schema when creating session and keyspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel committed Jan 31, 2016
1 parent a12c399 commit 2d7bb62
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,20 @@ func createKeyspace(tb testing.TB, cluster *ClusterConfig, keyspace string) {
defer session.Close()
defer log.Println("closing keyspace session")

err = session.control.query(`DROP KEYSPACE IF EXISTS ` + keyspace).Close()
err = createTable(session, `DROP KEYSPACE IF EXISTS `+keyspace)
if err != nil {
tb.Fatal(err)
}

err = session.control.query(fmt.Sprintf(`CREATE KEYSPACE %s
err = createTable(session, fmt.Sprintf(`CREATE KEYSPACE %s
WITH replication = {
'class' : 'SimpleStrategy',
'replication_factor' : %d
}`, keyspace, *flagRF)).Close()
}`, keyspace, *flagRF))

if err != nil {
tb.Fatal(err)
}

// lets just be sure
if err := session.control.awaitSchemaAgreement(); err != nil {
tb.Fatal(err)
}
}

func createSessionFromCluster(cluster *ClusterConfig, tb testing.TB) *Session {
Expand All @@ -130,6 +125,10 @@ func createSessionFromCluster(cluster *ClusterConfig, tb testing.TB) *Session {
tb.Fatal("createSession:", err)
}

if err := session.control.awaitSchemaAgreement(); err != nil {
tb.Fatal(err)
}

return session
}

Expand Down

0 comments on commit 2d7bb62

Please sign in to comment.