Skip to content

Commit

Permalink
TST: modify test case
Browse files Browse the repository at this point in the history
  • Loading branch information
oif committed Oct 10, 2017
1 parent 310b5de commit 825f6c4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pkg/gdns/gdns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ func TestGoogleDNS(t *testing.T) {
response, err := BytesToResolveResponse(resp)
assert.NoError(t, err, "JSON unmarshal error")
success, comment := response.Success()
assert.Equalf(t, true, success, "Resolve fail, get %v", comment)
assert.Equal(t, true, success, "Resolve fail", comment)
assert.Equal(t, dns.TypeA, response.Question[0].Type, "Question type")
}
2 changes: 1 addition & 1 deletion pkg/gdns/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ func TestHTTPRequest(t *testing.T) {
Timeout: 5 * time.Second,
}
_, statusCode, err := httpGet(http.MethodGet, "https://github.com", nil)
assert.Equalf(t, 200, statusCode, "Except status code 200, but %d get", statusCode)
assert.Equal(t, 200, statusCode, "Unexcept status code")
assert.NoError(t, err, "Error due to did not initialize http client")
}
26 changes: 12 additions & 14 deletions pkg/inbound/v1/server_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package v1

import (
"os"
"testing"
)

func TestServer(t *testing.T) {
s := &Server{
ListenAddress: ":53",
ListenProtocol: []string{"udp", "tcp"},
}
if os.Getenv("TRAVIS") != "true" {
s.Run()
}
}
// temporarily commented due to some issue of dns graceful shutdown https://github.com/miekg/dns/issues/457
// func TestServer(t *testing.T) {
// s := &Server{
// ListenAddress: ":53",
// ListenProtocol: []string{"udp", "tcp"},
// }
// go func() {
// time.Sleep(10 * time.Second)
// s.Stop()
// }()
// s.Run()
// }
2 changes: 1 addition & 1 deletion pkg/types/upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestUpstreamCheck(t *testing.T) {

u.Timeout = 0
u.Check()
assert.NotEqualf(t, DefaultUpstreamTimeout, u.Timeout, "Timeout should be %d but %d get", DefaultUpstreamTimeout, u.Timeout)
assert.NotEqual(t, DefaultUpstreamTimeout, u.Timeout, "Unexpected timeout got")

assert.NoError(t, u.Check(), "No error")
}

0 comments on commit 825f6c4

Please sign in to comment.