Actually run protocol tests faster with -short (on Go 1.5...)
This commit is contained in:
parent
8c7d9f3dd2
commit
8c26fe44c3
@ -27,13 +27,14 @@ var (
|
|||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if testing.Short() {
|
if flag.Lookup("test.short").Value.String() != "false" {
|
||||||
quickCfg.MaxCount = 10
|
quickCfg.MaxCount = 10
|
||||||
}
|
}
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHeaderFunctions(t *testing.T) {
|
func TestHeaderFunctions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
f := func(ver, id, typ int) bool {
|
f := func(ver, id, typ int) bool {
|
||||||
ver = int(uint(ver) % 16)
|
ver = int(uint(ver) % 16)
|
||||||
id = int(uint(id) % 4096)
|
id = int(uint(id) % 4096)
|
||||||
@ -48,6 +49,7 @@ func TestHeaderFunctions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHeaderLayout(t *testing.T) {
|
func TestHeaderLayout(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var e, a uint32
|
var e, a uint32
|
||||||
|
|
||||||
// Version are the first four bits
|
// Version are the first four bits
|
||||||
@ -73,6 +75,7 @@ func TestHeaderLayout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPing(t *testing.T) {
|
func TestPing(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
ar, aw := io.Pipe()
|
ar, aw := io.Pipe()
|
||||||
br, bw := io.Pipe()
|
br, bw := io.Pipe()
|
||||||
|
|
||||||
@ -92,6 +95,7 @@ func TestPing(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestVersionErr(t *testing.T) {
|
func TestVersionErr(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
m0 := newTestModel()
|
m0 := newTestModel()
|
||||||
m1 := newTestModel()
|
m1 := newTestModel()
|
||||||
|
|
||||||
@ -119,6 +123,7 @@ func TestVersionErr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTypeErr(t *testing.T) {
|
func TestTypeErr(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
m0 := newTestModel()
|
m0 := newTestModel()
|
||||||
m1 := newTestModel()
|
m1 := newTestModel()
|
||||||
|
|
||||||
@ -146,6 +151,7 @@ func TestTypeErr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestClose(t *testing.T) {
|
func TestClose(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
m0 := newTestModel()
|
m0 := newTestModel()
|
||||||
m1 := newTestModel()
|
m1 := newTestModel()
|
||||||
|
|
||||||
@ -181,6 +187,7 @@ func TestClose(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestElementSizeExceededNested(t *testing.T) {
|
func TestElementSizeExceededNested(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
m := ClusterConfigMessage{
|
m := ClusterConfigMessage{
|
||||||
ClientName: "longstringlongstringlongstringinglongstringlongstringlonlongstringlongstringlon",
|
ClientName: "longstringlongstringlongstringinglongstringlongstringlonlongstringlongstringlon",
|
||||||
}
|
}
|
||||||
@ -191,6 +198,7 @@ func TestElementSizeExceededNested(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMarshalIndexMessage(t *testing.T) {
|
func TestMarshalIndexMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
f := func(m1 IndexMessage) bool {
|
f := func(m1 IndexMessage) bool {
|
||||||
for i, f := range m1.Files {
|
for i, f := range m1.Files {
|
||||||
m1.Files[i].CachedSize = 0
|
m1.Files[i].CachedSize = 0
|
||||||
@ -211,6 +219,7 @@ func TestMarshalIndexMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMarshalRequestMessage(t *testing.T) {
|
func TestMarshalRequestMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
f := func(m1 RequestMessage) bool {
|
f := func(m1 RequestMessage) bool {
|
||||||
return testMarshal(t, "request", &m1, &RequestMessage{})
|
return testMarshal(t, "request", &m1, &RequestMessage{})
|
||||||
}
|
}
|
||||||
@ -221,6 +230,7 @@ func TestMarshalRequestMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMarshalResponseMessage(t *testing.T) {
|
func TestMarshalResponseMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
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
|
||||||
@ -234,6 +244,7 @@ func TestMarshalResponseMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMarshalClusterConfigMessage(t *testing.T) {
|
func TestMarshalClusterConfigMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
f := func(m1 ClusterConfigMessage) bool {
|
f := func(m1 ClusterConfigMessage) bool {
|
||||||
return testMarshal(t, "clusterconfig", &m1, &ClusterConfigMessage{})
|
return testMarshal(t, "clusterconfig", &m1, &ClusterConfigMessage{})
|
||||||
}
|
}
|
||||||
@ -244,6 +255,7 @@ func TestMarshalClusterConfigMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMarshalCloseMessage(t *testing.T) {
|
func TestMarshalCloseMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
f := func(m1 CloseMessage) bool {
|
f := func(m1 CloseMessage) bool {
|
||||||
return testMarshal(t, "close", &m1, &CloseMessage{})
|
return testMarshal(t, "close", &m1, &CloseMessage{})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user