zettio/weave#362 - properly test the TCP-retry mechanism by creating fallback servers that return truncated responses with UDP but not with TCP
This commit is contained in:
1 parent
3de924fa2f
commit
f8b3c86498
2 files changed
+128
-63
No files matched your search
@@ -7,6 +7,18 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func AssertTrue(t *testing.T, cond bool, desc string) {
|
||||
if !cond {
|
||||
Fatalf(t, "Expected %s to be true", desc)
|
||||
}
|
||||
}
|
||||
|
||||
func AssertFalse(t *testing.T, cond bool, desc string) {
|
||||
if cond {
|
||||
Fatalf(t, "Expected %s to be false", desc)
|
||||
}
|
||||
}
|
||||
|
||||
func AssertNoErr(t *testing.T, err error) {
|
||||
if err != nil {
|
||||
Fatalf(t, "Unexpected error: %s", err)
|
||||
@@ -25,6 +37,12 @@ func AssertEqualInt(t *testing.T, got, wanted int, desc string) {
|
||||
}
|
||||
}
|
||||
|
||||
func AssertNotEqualInt(t *testing.T, got, wanted int, desc string) {
|
||||
if got == wanted {
|
||||
Fatalf(t, "Expected %s %d to be different to %d", desc, wanted, got)
|
||||
}
|
||||
}
|
||||
|
||||
func AssertEqualString(t *testing.T, got, wanted string, desc string) {
|
||||
if got != wanted {
|
||||
Fatalf(t, "Expected %s '%s' but got '%s'", desc, wanted, got)
|
||||
|
||||
Reference in new issue
Block a user