Don't always run the tedious protocol tests

This commit is contained in:
Jakob Borg 2014-08-01 16:30:13 +02:00
parent 47a70a536b
commit f34f5e41a4
2 changed files with 34 additions and 9 deletions

View File

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

View File

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