Browse Source

Try to delineate between unit and integration tests

Ben Hood 11 năm trước cách đây
mục cha
commit
5188b26444
12 tập tin đã thay đổi với 23 bổ sung21 xóa
  1. 1 0
      .travis.yml
  2. 2 0
      cass1batch_test.go
  3. 1 3
      cassandra_test.go
  4. 2 0
      compressor_test.go
  5. 4 6
      conn_test.go
  6. 2 0
      errors_test.go
  7. 4 3
      integration.sh
  8. 2 0
      marshal_test.go
  9. 2 0
      session_test.go
  10. 1 3
      topology_test.go
  11. 1 3
      uuid_test.go
  12. 1 3
      wiki_test.go

+ 1 - 0
.travis.yml

@@ -25,6 +25,7 @@ install:
   - go get .
 
 script:
+  - go test -v -tags unit
   - bash -x integration.sh $CASS
   - go vet .
 

+ 2 - 0
cass1batch_test.go

@@ -1,3 +1,5 @@
+// +build all integration
+
 package gocql
 
 import (

+ 1 - 3
cassandra_test.go

@@ -1,6 +1,4 @@
-// Copyright (c) 2012 The gocql Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// +build all integration
 
 package gocql
 

+ 2 - 0
compressor_test.go

@@ -1,3 +1,5 @@
+// +build all unit
+
 package gocql
 
 import (

+ 4 - 6
conn_test.go

@@ -1,20 +1,18 @@
-// Copyright (c) 2012 The gocql Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// +build all unit
 
 package gocql
 
 import (
+	"crypto/tls"
+	"crypto/x509"
 	"io"
+	"io/ioutil"
 	"net"
 	"strings"
 	"sync"
 	"sync/atomic"
 	"testing"
 	"time"
-	"crypto/tls"
-	"crypto/x509"
-	"io/ioutil"
 )
 
 type TestServer struct {

+ 2 - 0
errors_test.go

@@ -1,3 +1,5 @@
+// +build all integration
+
 package gocql
 
 import (

+ 4 - 3
integration.sh

@@ -15,15 +15,16 @@ function run_tests() {
 	ccm start -v
 	ccm status
 	ccm node1 nodetool status
-	ccm node1 showlog > n1_status.log
-	cat n1_status.log
+	
+	# ccm node1 showlog > n1_status.log
+	# cat n1_status.log
 
 	local proto=2
 	if [[ $version == 1.2.* ]]; then
 		proto=1
 	fi
 
-	go test -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... > results
+	go test -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... > results
 
 	cat results
 	cover=`cat results | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`

+ 2 - 0
marshal_test.go

@@ -1,3 +1,5 @@
+// +build all unit
+
 package gocql
 
 import (

+ 2 - 0
session_test.go

@@ -1,3 +1,5 @@
+// +build all integration
+
 package gocql
 
 import (

+ 1 - 3
topology_test.go

@@ -1,6 +1,4 @@
-// Copyright (c) 2012 The gocql Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// +build all unit
 
 package gocql
 

+ 1 - 3
uuid_test.go

@@ -1,6 +1,4 @@
-// Copyright (c) 2012 The gocql Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// +build all unit
 
 package gocql
 

+ 1 - 3
wiki_test.go

@@ -1,6 +1,4 @@
-// Copyright (c) 2014 The gocql Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// +build all integration
 
 package gocql