Browse Source

Don't always run the tedious protocol tests

Jakob Borg 11 years ago
parent
commit
f34f5e41a4
2 changed files with 34 additions and 9 deletions
  1. 4 4
      build.sh
  2. 30 5
      protocol/protocol_test.go

+ 4 - 4
build.sh

@@ -47,7 +47,7 @@ test-cov() {
 test() {
 	check
 	go vet ./...
-	godep go test -cpu=1,2,4 ./...
+	godep go test -cpu=1,2,4 $* ./...
 }
 
 sign() {
@@ -133,7 +133,7 @@ case "$1" in
 		;;
 
 	test)
-		test
+		test -short
 		;;
 
 	test-cov)
@@ -142,7 +142,7 @@ case "$1" in
 
 	tar)
 		rm -f *.tar.gz *.zip
-		test || exit 1
+		test -short || exit 1
 		assets
 		build
 
@@ -154,7 +154,7 @@ case "$1" in
 
 	all)
 		rm -f *.tar.gz *.zip
-		test || exit 1
+		test -short || exit 1
 		assets
 
 		for os in darwin-amd64 linux-386 linux-amd64 freebsd-amd64 windows-amd64 windows-386 solaris-amd64 ; do

+ 30 - 5
protocol/protocol_test.go

@@ -251,6 +251,11 @@ func TestElementSizeExceededNested(t *testing.T) {
 }
 
 func TestMarshalIndexMessage(t *testing.T) {
+	var quickCfg = &quick.Config{MaxCountScale: 10}
+	if testing.Short() {
+		quickCfg = nil
+	}
+
 	f := func(m1 IndexMessage) bool {
 		for _, f := range m1.Files {
 			for i := range f.Blocks {
@@ -264,22 +269,32 @@ func TestMarshalIndexMessage(t *testing.T) {
 		return testMarshal(t, "index", &m1, &IndexMessage{})
 	}
 
-	if err := quick.Check(f, &quick.Config{MaxCountScale: 10}); err != nil {
+	if err := quick.Check(f, quickCfg); err != nil {
 		t.Error(err)
 	}
 }
 
 func TestMarshalRequestMessage(t *testing.T) {
+	var quickCfg = &quick.Config{MaxCountScale: 10}
+	if testing.Short() {
+		quickCfg = nil
+	}
+
 	f := func(m1 RequestMessage) bool {
 		return testMarshal(t, "request", &m1, &RequestMessage{})
 	}
 
-	if err := quick.Check(f, &quick.Config{MaxCountScale: 10}); err != nil {
+	if err := quick.Check(f, quickCfg); err != nil {
 		t.Error(err)
 	}
 }
 
 func TestMarshalResponseMessage(t *testing.T) {
+	var quickCfg = &quick.Config{MaxCountScale: 10}
+	if testing.Short() {
+		quickCfg = nil
+	}
+
 	f := func(m1 ResponseMessage) bool {
 		if len(m1.Data) == 0 {
 			m1.Data = nil
@@ -287,27 +302,37 @@ func TestMarshalResponseMessage(t *testing.T) {
 		return testMarshal(t, "response", &m1, &ResponseMessage{})
 	}
 
-	if err := quick.Check(f, &quick.Config{MaxCountScale: 10}); err != nil {
+	if err := quick.Check(f, quickCfg); err != nil {
 		t.Error(err)
 	}
 }
 
 func TestMarshalClusterConfigMessage(t *testing.T) {
+	var quickCfg = &quick.Config{MaxCountScale: 10}
+	if testing.Short() {
+		quickCfg = nil
+	}
+
 	f := func(m1 ClusterConfigMessage) bool {
 		return testMarshal(t, "clusterconfig", &m1, &ClusterConfigMessage{})
 	}
 
-	if err := quick.Check(f, &quick.Config{MaxCountScale: 10}); err != nil {
+	if err := quick.Check(f, quickCfg); err != nil {
 		t.Error(err)
 	}
 }
 
 func TestMarshalCloseMessage(t *testing.T) {
+	var quickCfg = &quick.Config{MaxCountScale: 10}
+	if testing.Short() {
+		quickCfg = nil
+	}
+
 	f := func(m1 CloseMessage) bool {
 		return testMarshal(t, "close", &m1, &CloseMessage{})
 	}
 
-	if err := quick.Check(f, &quick.Config{MaxCountScale: 10}); err != nil {
+	if err := quick.Check(f, quickCfg); err != nil {
 		t.Error(err)
 	}
 }