forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors_test.go
29 lines (24 loc) · 755 Bytes
/
errors_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// +build all integration
package gocql
import (
"testing"
)
func TestErrorsParse(t *testing.T) {
session := createSession(t)
defer session.Close()
if err := createTable(session, `CREATE TABLE gocql_test.errors_parse (id int primary key)`); err != nil {
t.Fatal("create:", err)
}
if err := createTable(session, `CREATE TABLE gocql_test.errors_parse (id int primary key)`); err == nil {
t.Fatal("Should have gotten already exists error from cassandra server.")
} else {
switch e := err.(type) {
case *RequestErrAlreadyExists:
if e.Table != "errors_parse" {
t.Fatalf("expected error table to be 'errors_parse' but was %q", e.Table)
}
default:
t.Fatalf("expected to get RequestErrAlreadyExists instead got %T", e)
}
}
}