presubmit: check for uppercase (#1774)

Another thing we can test automatically, we sorta settled on using an
uppercase letter in in t.Log and t.Fatal calls.

Let's just check for this.
This commit is contained in:
Miek Gieben
2018-05-07 22:47:25 +01:00
committed by Yong Tang
parent 15d989e294
commit 643550eabe
25 changed files with 104 additions and 90 deletions

View File

@@ -48,6 +48,6 @@ func TestEncoderCompatibility(t *testing.T) {
//compare results
if !bytes.Equal(fsW.Bytes(), dnstapW.Bytes()) {
t.Fatal("dnstapEncoder is not compatible with framestream Encoder")
t.Fatal("DnstapEncoder is not compatible with framestream Encoder")
}
}

View File

@@ -23,7 +23,7 @@ var (
func accept(t *testing.T, l net.Listener, count int) {
server, err := l.Accept()
if err != nil {
t.Fatalf("server accept: %s", err)
t.Fatalf("Server accepted: %s", err)
return
}
@@ -32,13 +32,13 @@ func accept(t *testing.T, l net.Listener, count int) {
Bidirectional: true,
})
if err != nil {
t.Fatalf("server decoder: %s", err)
t.Fatalf("Server decoder: %s", err)
return
}
for i := 0; i < count; i++ {
if _, err := dec.Decode(); err != nil {
t.Errorf("server decode: %s", err)
t.Errorf("Server decode: %s", err)
}
}

View File

@@ -103,7 +103,7 @@ func TestError(t *testing.T) {
// the dnstap error will show only if there is no plugin error
_, err := h.ServeDNS(context.TODO(), rw, nil)
if err == nil || !strings.HasPrefix(err.Error(), "plugin/dnstap") {
t.Fatal("must return the dnstap error but have:", err)
t.Fatal("Must return the dnstap error but have:", err)
}
// plugin errors will always overwrite dnstap errors
@@ -111,6 +111,6 @@ func TestError(t *testing.T) {
h.Next = endWith(0, pluginErr)
_, err = h.ServeDNS(context.TODO(), rw, nil)
if err != pluginErr {
t.Fatal("must return the plugin error but have:", err)
t.Fatal("Must return the plugin error but have:", err)
}
}

View File

@@ -19,7 +19,7 @@ func testRequest(t *testing.T, expected Builder, r request.Request) {
d.SocketFam != expected.SocketFam ||
!reflect.DeepEqual(d.Address, expected.Address) ||
d.Port != expected.Port {
t.Fatalf("expected: %v, have: %v", expected, d)
t.Fatalf("Expected: %v, have: %v", expected, d)
return
}
}

View File

@@ -39,7 +39,7 @@ func TestClientQueryResponse(t *testing.T) {
return
}
if l := len(trapper.Trap); l != 2 {
t.Fatalf("%d msg trapped", l)
t.Fatalf("Mmsg %d trapped", l)
return
}
want, err := d.ToClientQuery()
@@ -48,7 +48,7 @@ func TestClientQueryResponse(t *testing.T) {
}
have := trapper.Trap[0]
if !test.MsgEqual(want, have) {
t.Fatalf("query: want: %v\nhave: %v", want, have)
t.Fatalf("Query: want: %v\nhave: %v", want, have)
}
want, err = d.ToClientResponse()
if err != nil {
@@ -56,7 +56,7 @@ func TestClientQueryResponse(t *testing.T) {
}
have = trapper.Trap[1]
if !test.MsgEqual(want, have) {
t.Fatalf("response: want: %v\nhave: %v", want, have)
t.Fatalf("Response: want: %v\nhave: %v", want, have)
}
}