Skip to content

Commit

Permalink
Merge MASTER into cluster-ring-discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
0x6e6562 committed Aug 13, 2014
2 parents 8303a18 + b8692cd commit 9b02df3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ Project Website: http://gocql.github.io/<br>
API documentation: http://godoc.org/github.com/gocql/gocql<br>
Discussions: https://groups.google.com/forum/#!forum/gocql

Supported Versions: Cassandra 1.2, 2.0, 2.1; Go 1.2, 1.3
Supported Versions
------------------

The following matrix shows the versions of Go and Cassandra that are tested with the integration test suite as part of the CI build:

Go/Cassandra | 1.2.18 | 2.0.9 | 2.1.0-RC5
-------------| -------| ------| ---------
1.2 | yes | yes | partial
1.3 | yes | yes | partial

Installation
------------
Expand Down
25 changes: 24 additions & 1 deletion cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
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")
flagRetry = flag.Int("retries", 5, "number of times to retry queries")
clusterHosts []string
)

Expand Down Expand Up @@ -55,7 +56,7 @@ func createSession(tb testing.TB) *Session {
cluster.CQLVersion = *flagCQL
cluster.Timeout = 5 * time.Second
cluster.Consistency = Quorum
cluster.RetryPolicy.NumRetries = 2
cluster.RetryPolicy.NumRetries = *flagRetry

initOnce.Do(func() {
session, err := cluster.CreateSession()
Expand Down Expand Up @@ -833,6 +834,28 @@ func injectInvalidPreparedStatement(t *testing.T, session *Session, table string
return stmt, conn
}

func TestMissingSchemaPrepare(t *testing.T) {
s := createSession(t)
conn := s.Pool.Pick(nil)
defer s.Close()

insertQry := &Query{stmt: "INSERT INTO invalidschemaprep (val) VALUES (?)", values: []interface{}{5}, cons: s.cons,
session: s, pageSize: s.pageSize, trace: s.trace,
prefetch: s.prefetch, rt: s.cfg.RetryPolicy}

if err := conn.executeQuery(insertQry).err; err == nil {
t.Fatal("expected error, but got nil.")
}

if err := createTable(s, "CREATE TABLE invalidschemaprep (val int, PRIMARY KEY (val))"); err != nil {
t.Fatal("create table:", err)
}

if err := conn.executeQuery(insertQry).err; err != nil {
t.Fatal(err) // unconfigured columnfamily
}
}

func TestReprepareStatement(t *testing.T) {
session := createSession(t)
defer session.Close()
Expand Down
1 change: 1 addition & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ func (c *Conn) prepareStatement(stmt string, trace Tracer) (*QueryInfo, error) {
default:
flight.err = NewErrProtocol("Unknown type in response to prepare frame: %s", x)
}
err = flight.err
}

flight.wg.Done()
Expand Down
2 changes: 1 addition & 1 deletion integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function run_tests() {
local clusterSize=3
local version=$1

ccm create test -v $version -n $clusterSize -s -d --vnodes
ccm create test -v binary:$version -n 3 -s -d --vnodes
ccm status
ccm updateconf 'concurrent_reads: 8' 'concurrent_writes: 32' 'rpc_server_type: sync' 'rpc_min_threads: 2' 'rpc_max_threads: 8' 'write_request_timeout_in_ms: 5000' 'read_request_timeout_in_ms: 5000'

Expand Down
9 changes: 7 additions & 2 deletions wiki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (w *WikiTest) CreateSchema() {
if err := w.session.Query(`DROP TABLE wiki_page`).Exec(); err != nil && err.Error() != "unconfigured columnfamily wiki_page" {
w.tb.Fatal("CreateSchema:", err)
}
if err := createTable(w.session, `CREATE TABLE wiki_page (
err := createTable(w.session, `CREATE TABLE wiki_page (
title varchar,
revid timeuuid,
body varchar,
Expand All @@ -69,7 +69,12 @@ func (w *WikiTest) CreateSchema() {
tags set<varchar>,
attachments map<varchar, blob>,
PRIMARY KEY (title, revid)
)`); err != nil {
)`)
if clusterSize > 1 {
// wait for table definition to propogate
time.Sleep(250 * time.Millisecond)
}
if err != nil {
w.tb.Fatal("CreateSchema:", err)
}
}
Expand Down

0 comments on commit 9b02df3

Please sign in to comment.