Jelajahi Sumber

Merge pull request #341 from Zariel/compressor-test

tests: add flag to enable compression, enable snappy for integration suite
Ben Hood 10 tahun lalu
induk
melakukan
e9eb915c0a
2 mengubah file dengan 20 tambahan dan 10 penghapusan
  1. 19 9
      cassandra_test.go
  2. 1 1
      integration.sh

+ 19 - 9
cassandra_test.go

@@ -22,15 +22,16 @@ import (
 )
 )
 
 
 var (
 var (
-	flagCluster    = flag.String("cluster", "127.0.0.1", "a comma-separated list of host:port tuples")
-	flagProto      = flag.Int("proto", 2, "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")
-	flagRetry      = flag.Int("retries", 5, "number of times to retry queries")
-	flagAutoWait   = flag.Duration("autowait", 1000*time.Millisecond, "time to wait for autodiscovery to fill the hosts poll")
-	flagRunSslTest = flag.Bool("runssl", false, "Set to true to run ssl test")
-	clusterHosts   []string
+	flagCluster      = flag.String("cluster", "127.0.0.1", "a comma-separated list of host:port tuples")
+	flagProto        = flag.Int("proto", 2, "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")
+	flagRetry        = flag.Int("retries", 5, "number of times to retry queries")
+	flagAutoWait     = flag.Duration("autowait", 1000*time.Millisecond, "time to wait for autodiscovery to fill the hosts poll")
+	flagRunSslTest   = flag.Bool("runssl", false, "Set to true to run ssl test")
+	flagCompressTest = flag.String("compressor", "", "compressor to use")
+	clusterHosts     []string
 )
 )
 
 
 func init() {
 func init() {
@@ -71,6 +72,15 @@ func createCluster() *ClusterConfig {
 	if *flagRetry > 0 {
 	if *flagRetry > 0 {
 		cluster.RetryPolicy = &SimpleRetryPolicy{NumRetries: *flagRetry}
 		cluster.RetryPolicy = &SimpleRetryPolicy{NumRetries: *flagRetry}
 	}
 	}
+
+	switch *flagCompressTest {
+	case "snappy":
+		cluster.Compressor = &SnappyCompressor{}
+	case "":
+	default:
+		panic("invalid compressor: " + *flagCompressTest)
+	}
+
 	cluster = addSslOptions(cluster)
 	cluster = addSslOptions(cluster)
 	return cluster
 	return cluster
 }
 }

+ 1 - 1
integration.sh

@@ -23,7 +23,7 @@ function run_tests() {
 		proto=3
 		proto=3
 	fi
 	fi
 
 
-	go test -timeout 5m -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... | tee results.txt
+	go test -timeout 5m -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms -compressor=snappy ./... | tee results.txt
 
 
 	if [ ${PIPESTATUS[0]} -ne 0 ]; then
 	if [ ${PIPESTATUS[0]} -ne 0 ]; then
 		echo "--- FAIL: ccm status follows:"
 		echo "--- FAIL: ccm status follows:"