Skip to content

Commit

Permalink
tests: use discovered protocol not flag proto to enable udt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel committed Jun 25, 2017
1 parent be48a66 commit 7113222
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var (
flagCluster = flag.String("cluster", "127.0.0.1", "a comma-separated list of host:port tuples")
flagProto = flag.Int("proto", 2, "protcol version")
flagProto = flag.Int("proto", 0, "protcol version")
flagCQL = flag.String("cql", "3.0.0", "CQL version")
flagRF = flag.Int("rf", 1, "replication factor for test keyspace")
clusterSize = flag.Int("clusterSize", 1, "the expected size of the cluster")
Expand Down
56 changes: 28 additions & 28 deletions udt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func (p *position) UnmarshalUDT(name string, info TypeInfo, data []byte) error {
}

func TestUDT_Marshaler(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.position(
lat int,
lon int,
Expand Down Expand Up @@ -100,14 +100,14 @@ func TestUDT_Marshaler(t *testing.T) {
}

func TestUDT_Reflect(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

// Uses reflection instead of implementing the marshaling type
session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.horse(
name text,
owner text);`)
Expand Down Expand Up @@ -160,13 +160,13 @@ func TestUDT_Proto2error(t *testing.T) {
}

func TestUDT_NullObject(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.udt_null_type(
name text,
owner text);`)
Expand Down Expand Up @@ -214,13 +214,13 @@ func TestUDT_NullObject(t *testing.T) {
}

func TestMapScanUDT(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.log_entry (
created_timestamp timestamp,
message text
Expand Down Expand Up @@ -351,13 +351,13 @@ func TestUDT_MissingField(t *testing.T) {
}

func TestUDT_EmptyCollections(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.nil_collections(
a list<text>,
b map<text, text>,
Expand Down Expand Up @@ -407,13 +407,13 @@ func TestUDT_EmptyCollections(t *testing.T) {
}

func TestUDT_UpdateField(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.update_field_udt(
name text,
owner text);`)
Expand Down Expand Up @@ -464,13 +464,13 @@ func TestUDT_UpdateField(t *testing.T) {
}

func TestUDT_ScanNullUDT(t *testing.T) {
if *flagProto < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

session := createSession(t)
defer session.Close()

if session.cfg.ProtoVersion < protoVersion3 {
t.Skip("UDT are only available on protocol >= 3")
}

err := createTable(session, `CREATE TYPE gocql_test.scan_null_udt_position(
lat int,
lon int,
Expand Down

0 comments on commit 7113222

Please sign in to comment.