Skip to content

Commit

Permalink
test: fix duplicate test in all build (apache#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel authored Oct 23, 2018
1 parent 6832a79 commit 2127b8d
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1514,48 +1514,6 @@ func TestPrepare_PreparedCacheEviction(t *testing.T) {
}
}

func TestWriteFailure(t *testing.T) {
if flagCassVersion.Major == 0 || flagCassVersion.Before(3, 11, 0) {
t.Skipf("write failure can only be tested against Cassandra 3.11 or higher version=%v", flagCassVersion)
}
cluster := createCluster()
createKeyspace(t, cluster, "test")
cluster.Keyspace = "test"
session, err := cluster.CreateSession()
if err != nil {
t.Fatal("create session:", err)
}
defer session.Close()

if err := createTable(session, "CREATE TABLE test.test (id int,value int,PRIMARY KEY (id))"); err != nil {
t.Fatalf("failed to create table with error '%v'", err)
}
if err := session.Query(`INSERT INTO test.test (id, value) VALUES (1, 1)`).Exec(); err != nil {
errWrite, ok := err.(*RequestErrWriteFailure)
if ok {
if session.cfg.ProtoVersion >= 5 {
// ErrorMap should be filled with some hosts that should've errored
if len(errWrite.ErrorMap) == 0 {
t.Fatal("errWrite.ErrorMap should have some failed hosts but it didn't have any")
}
} else {
// Map doesn't get filled for V4
if len(errWrite.ErrorMap) != 0 {
t.Fatal("errWrite.ErrorMap should have length 0, it's: ", len(errWrite.ErrorMap))
}
}
} else {
t.Fatal("error should be RequestErrWriteFailure, it's: ", errWrite)
}
} else {
t.Fatal("a write fail error should have happened when querying test keyspace")
}

if err = session.Query("DROP KEYSPACE test").Exec(); err != nil {
t.Fatal(err)
}
}

func TestPrepare_PreparedCacheKey(t *testing.T) {
session := createSession(t)
defer session.Close()
Expand Down

0 comments on commit 2127b8d

Please sign in to comment.