mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
presubmit: Check errorf as well (#1845)
Uppercase all these test errors as well. And extend the presubmit to check for these in the future. Also do a slightly smarter grep to only get t.<something>. as (because dump regexp) this also grep over non test files.
This commit is contained in:
@@ -12,7 +12,7 @@ func TestVersion(t *testing.T) {
|
||||
|
||||
_, err := Version(m)
|
||||
if err == nil {
|
||||
t.Errorf("expected wrong version, but got OK")
|
||||
t.Errorf("Expected wrong version, but got OK")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestVersionNoEdns(t *testing.T) {
|
||||
|
||||
_, err := Version(m)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error, but got one: %s", err)
|
||||
t.Errorf("Expected no error, but got one: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ func TestTypifyNilMsg(t *testing.T) {
|
||||
|
||||
ty, _ := Typify(m, time.Now().UTC())
|
||||
if ty != OtherError {
|
||||
t.Errorf("message wrongly typified, expected OtherError, got %s", ty)
|
||||
t.Errorf("Message wrongly typified, expected OtherError, got %s", ty)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestTypifyDelegation(t *testing.T) {
|
||||
m := delegationMsg()
|
||||
mt, _ := Typify(m, time.Now().UTC())
|
||||
if mt != Delegation {
|
||||
t.Errorf("message is wrongly typified, expected Delegation, got %s", mt)
|
||||
t.Errorf("Message is wrongly typified, expected Delegation, got %s", mt)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,19 +32,19 @@ func TestTypifyRRSIG(t *testing.T) {
|
||||
|
||||
m := delegationMsgRRSIGOK()
|
||||
if mt, _ := Typify(m, utc); mt != Delegation {
|
||||
t.Errorf("message is wrongly typified, expected Delegation, got %s", mt)
|
||||
t.Errorf("Message is wrongly typified, expected Delegation, got %s", mt)
|
||||
}
|
||||
|
||||
// Still a Delegation because EDNS0 OPT DO bool is not set, so we won't check the sigs.
|
||||
m = delegationMsgRRSIGFail()
|
||||
if mt, _ := Typify(m, utc); mt != Delegation {
|
||||
t.Errorf("message is wrongly typified, expected Delegation, got %s", mt)
|
||||
t.Errorf("Message is wrongly typified, expected Delegation, got %s", mt)
|
||||
}
|
||||
|
||||
m = delegationMsgRRSIGFail()
|
||||
m = addOpt(m)
|
||||
if mt, _ := Typify(m, utc); mt != OtherError {
|
||||
t.Errorf("message is wrongly typified, expected OtherError, got %s", mt)
|
||||
t.Errorf("Message is wrongly typified, expected OtherError, got %s", mt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestDoErr(t *testing.T) {
|
||||
t.Errorf("Do error = %v; want someErr", err)
|
||||
}
|
||||
if v != nil {
|
||||
t.Errorf("unexpected non-nil value %#v", v)
|
||||
t.Errorf("Unexpected non-nil value %#v", v)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func TestDoDupSuppress(t *testing.T) {
|
||||
t.Errorf("Do error: %v", err)
|
||||
}
|
||||
if v.(string) != "bar" {
|
||||
t.Errorf("got %q; want %q", v, "bar")
|
||||
t.Errorf("Got %q; want %q", v, "bar")
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
@@ -80,6 +80,6 @@ func TestDoDupSuppress(t *testing.T) {
|
||||
c <- "bar"
|
||||
wg.Wait()
|
||||
if got := atomic.LoadInt32(&calls); got != 1 {
|
||||
t.Errorf("number of calls = %d; want 1", got)
|
||||
t.Errorf("Number of calls = %d; want 1", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user