Skip to content

Commit

Permalink
Merge pull request apache#799 from Zariel/travis-cassandra-3
Browse files Browse the repository at this point in the history
travis: update to 3.0
  • Loading branch information
Zariel authored Oct 22, 2016
2 parents d3acb7c + 18f9871 commit 451ea64
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 193 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ env:
global:
- GOMAXPROCS=2
matrix:
- CASS=2.0.17
AUTH=false
- CASS=2.1.12
AUTH=false
- CASS=2.2.4
- CASS=2.2.5
AUTH=true
- CASS=2.2.5
AUTH=false
- CASS=3.0.8
AUTH=false

go:
- 1.6
Expand Down
65 changes: 36 additions & 29 deletions cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1657,14 +1657,19 @@ func TestGetTableMetadata(t *testing.T) {
if table.Keyspace != "gocql_test" {
t.Errorf("Expected keyspace for '%d' table metadata to be 'gocql_test' but was '%s'", table.Name, table.Keyspace)
}
if table.KeyValidator == "" {
t.Errorf("Expected key validator to be set for table %s", table.Name)
}
if table.Comparator == "" {
t.Errorf("Expected comparator to be set for table %s", table.Name)
}
if table.DefaultValidator == "" {
t.Errorf("Expected default validator to be set for table %s", table.Name)
if *flagProto < 4 {
// TODO(zariel): there has to be a better way to detect what metadata version
// we are in, and a better way to structure the code so that it is abstracted away
// from us here
if table.KeyValidator == "" {
t.Errorf("Expected key validator to be set for table %s", table.Name)
}
if table.Comparator == "" {
t.Errorf("Expected comparator to be set for table %s", table.Name)
}
if table.DefaultValidator == "" {
t.Errorf("Expected default validator to be set for table %s", table.Name)
}
}

// these fields are not set until the metadata is compiled
Expand All @@ -1688,16 +1693,16 @@ func TestGetTableMetadata(t *testing.T) {
if testTable == nil {
t.Fatal("Expected table metadata for name 'test_table_metadata'")
}
if testTable.KeyValidator != "org.apache.cassandra.db.marshal.Int32Type" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.Int32Type' but was '%s'", testTable.KeyValidator)
}
if testTable.Comparator != "org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)' but was '%s'", testTable.Comparator)
}
if testTable.DefaultValidator != "org.apache.cassandra.db.marshal.BytesType" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.BytesType' but was '%s'", testTable.DefaultValidator)
}
if *flagProto < protoVersion4 {
if testTable.KeyValidator != "org.apache.cassandra.db.marshal.Int32Type" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.Int32Type' but was '%s'", testTable.KeyValidator)
}
if testTable.Comparator != "org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)' but was '%s'", testTable.Comparator)
}
if testTable.DefaultValidator != "org.apache.cassandra.db.marshal.BytesType" {
t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.BytesType' but was '%s'", testTable.DefaultValidator)
}
expectedKeyAliases := []string{"first_id"}
if !reflect.DeepEqual(testTable.KeyAliases, expectedKeyAliases) {
t.Errorf("Expected key aliases %v but was %v", expectedKeyAliases, testTable.KeyAliases)
Expand Down Expand Up @@ -1748,10 +1753,10 @@ func TestGetColumnMetadata(t *testing.T) {
if column.Keyspace != "gocql_test" {
t.Errorf("Expected column %s keyspace name to be 'gocql_test', but it was '%s'", column.Name, column.Keyspace)
}
if column.Kind == "" {
if column.Kind == ColumnUnkownKind {
t.Errorf("Expected column %s kind to be set, but it was empty", column.Name)
}
if session.cfg.ProtoVersion == 1 && column.Kind != "regular" {
if session.cfg.ProtoVersion == 1 && column.Kind != ColumnRegular {
t.Errorf("Expected column %s kind to be set to 'regular' for proto V1 but it was '%s'", column.Name, column.Kind)
}
if column.Validator == "" {
Expand All @@ -1774,8 +1779,8 @@ func TestGetColumnMetadata(t *testing.T) {
t.Fatalf("Expected to find column 'third_id' metadata but there was only %v", testColumns)
}

if thirdID.Kind != REGULAR {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", thirdID.Name, REGULAR, thirdID.Kind)
if thirdID.Kind != ColumnRegular {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", thirdID.Name, ColumnRegular, thirdID.Kind)
}

if thirdID.Index.Name != "index_column_metadata" {
Expand All @@ -1798,17 +1803,18 @@ func TestGetColumnMetadata(t *testing.T) {
t.Fatalf("Expected to find column 'third_id' metadata but there was only %v", testColumns)
}

if firstID.Kind != PARTITION_KEY {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", firstID.Name, PARTITION_KEY, firstID.Kind)
if firstID.Kind != ColumnPartitionKey {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", firstID.Name, ColumnPartitionKey, firstID.Kind)
}
if secondID.Kind != CLUSTERING_KEY {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", secondID.Name, CLUSTERING_KEY, secondID.Kind)
if secondID.Kind != ColumnClusteringKey {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", secondID.Name, ColumnClusteringKey, secondID.Kind)
}
if thirdID.Kind != REGULAR {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", thirdID.Name, REGULAR, thirdID.Kind)
if thirdID.Kind != ColumnRegular {
t.Errorf("Expected %s column kind to be '%s' but it was '%s'", thirdID.Name, ColumnRegular, thirdID.Kind)
}

if thirdID.Index.Name != "index_column_metadata" {
if !session.useSystemSchema && thirdID.Index.Name != "index_column_metadata" {
// TODO(zariel): update metadata to scan index from system_schema
t.Errorf("Expected %s column index name to be 'index_column_metadata' but it was '%s'", thirdID.Name, thirdID.Index.Name)
}
}
Expand Down Expand Up @@ -1872,7 +1878,8 @@ func TestKeyspaceMetadata(t *testing.T) {
if !found {
t.Fatalf("Expected a column definition for 'third_id'")
}
if thirdColumn.Index.Name != "index_metadata" {
if !session.useSystemSchema && thirdColumn.Index.Name != "index_metadata" {
// TODO(zariel): scan index info from system_schema
t.Errorf("Expected column index named 'index_metadata' but was '%s'", thirdColumn.Index.Name)
}
}
Expand Down
7 changes: 5 additions & 2 deletions integration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -eux

function run_tests() {
local clusterSize=3
Expand Down Expand Up @@ -50,12 +50,15 @@ function run_tests() {
elif [[ $version == 2.2.* ]]; then
proto=4
ccm updateconf 'enable_user_defined_functions: true'
elif [[ $version == 3.*.* ]]; then
proto=4
ccm updateconf 'enable_user_defined_functions: true'
fi

sleep 1s

ccm list
ccm start
ccm start --wait-for-binary-proto
ccm status
ccm node1 nodetool status

Expand Down
Loading

0 comments on commit 451ea64

Please sign in to comment.