Sfoglia il codice sorgente

Merge pull request #163 from relops/supported_versions

Run test suite against multiple versions of Cassandra
Chris Bannister 11 anni fa
parent
commit
7e0a6d5586
2 ha cambiato i file con 52 aggiunte e 3 eliminazioni
  1. 6 3
      .travis.yml
  2. 46 0
      integration.sh

+ 6 - 3
.travis.yml

@@ -1,8 +1,11 @@
 language: go
+
 go:
   - 1.1
   - 1.2
-services:
-  - cassandra
+
+script:
+  - bash integration.sh
+
 notifications:
-  email: false
+  - email: false

+ 46 - 0
integration.sh

@@ -0,0 +1,46 @@
+#!/bin/bash
+
+set -e
+
+PID_FILE=cassandra.pid
+STARTUP_LOG=startup.log
+ARCHIVE_BASE_URL=http://archive.apache.org/dist/cassandra
+
+for v in 2.0.6 2.0.7
+do
+	TARBALL=apache-cassandra-$v-bin.tar.gz
+	CASSANDRA_DIR=apache-cassandra-$v
+
+	curl -L -O $ARCHIVE_BASE_URL/$v/$TARBALL
+	
+	if [ ! -f $CASSANDRA_DIR/bin/cassandra ]
+	then
+   		tar xzf $TARBALL
+	fi
+	
+	CASSANDRA_LOG_DIR=`pwd`/v${v}/log/cassandra
+	CASSANDRA_LOG=$CASSANDRA_LOG_DIR/system.log
+
+	mkdir -p $CASSANDRA_LOG_DIR
+	: >$CASSANDRA_LOG  # create an empty log file
+	
+	sed -i -e 's?/var?'`pwd`/v${v}'?' $CASSANDRA_DIR/conf/cassandra.yaml
+	sed -i -e 's?/var?'`pwd`/v${v}'?' $CASSANDRA_DIR/conf/log4j-server.properties
+
+	echo "Booting Cassandra ${v}, waiting for CQL listener to start ...."
+
+	$CASSANDRA_DIR/bin/cassandra -p $PID_FILE &> $STARTUP_LOG
+
+	{ tail -n +1 -f $CASSANDRA_LOG & } | sed -n '/Starting listening for CQL clients/q'
+	
+	PID=$(<"$PID_FILE")
+
+	echo "Cassandra ${v} running (PID ${PID}), about to run test suite ...."
+
+	go test -v ./...
+
+	echo "Test suite passed against Cassandra ${v}, killing server instance (PID ${PID})"
+	
+	kill -9 $PID
+	rm $PID_FILE
+done