mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
test: add t.Helper() calls to test helper functions (#7351)
This commit is contained in:
@@ -56,6 +56,7 @@ func TestLookupCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func testCase(t *testing.T, name, addr string, expectAnsLen int, expectTTL uint32) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion(name, dns.TypeA)
|
||||
resp, err := dns.Exchange(m, addr)
|
||||
@@ -74,6 +75,7 @@ func testCase(t *testing.T, name, addr string, expectAnsLen int, expectTTL uint3
|
||||
}
|
||||
|
||||
func testCaseDNSSEC(t *testing.T, name, addr string, bufsize int) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion(name, dns.TypeA)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func setupProxyTargetCoreDNS(t *testing.T, fn func(string)) {
|
||||
t.Helper()
|
||||
tmpdir := t.TempDir()
|
||||
|
||||
content := `
|
||||
|
||||
@@ -117,6 +117,7 @@ func getBucketCount(mf *test.MetricFamily, bucketLabel string) (int, error) {
|
||||
|
||||
// extractRequestSizeBucketCounts extracts bucket counts from DNS request size metrics
|
||||
func extractRequestSizeBucketCounts(t *testing.T, metrics []*test.MetricFamily, label string) (int, int, error) {
|
||||
t.Helper()
|
||||
var countBelow100, countAbove100 int
|
||||
var err error
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ func TestLookupBalanceRewriteCacheDnssec(t *testing.T) {
|
||||
}
|
||||
|
||||
func createKeyFile(t *testing.T) func() {
|
||||
t.Helper()
|
||||
os.WriteFile(base+".key",
|
||||
[]byte(`example.org. IN DNSKEY 256 3 13 tDyI0uEIDO4SjhTJh1AVTFBLpKhY3He5BdAlKztewiZ7GecWj94DOodg ovpN73+oJs+UfZ+p9zOSN5usGAlHrw==`),
|
||||
0644)
|
||||
|
||||
@@ -44,6 +44,7 @@ func TestReload(t *testing.T) {
|
||||
}
|
||||
|
||||
func send(t *testing.T, server string) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("whoami.example.org.", dns.TypeSRV)
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ func TestRewrite(t *testing.T) {
|
||||
}
|
||||
|
||||
func testMX(t *testing.T, server string) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("example.com.", dns.TypeMX)
|
||||
|
||||
@@ -78,6 +79,7 @@ func testMX(t *testing.T, server string) {
|
||||
}
|
||||
|
||||
func testEdns0(t *testing.T, server string) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("example.com.", dns.TypeA)
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ func TestProxyToChaosServer(t *testing.T) {
|
||||
}
|
||||
|
||||
func chaosTest(t *testing.T, server string) {
|
||||
t.Helper()
|
||||
m := new(dns.Msg)
|
||||
m.Question = make([]dns.Question, 1)
|
||||
m.Question[0] = dns.Question{Qclass: dns.ClassCHAOS, Name: "version.bind.", Qtype: dns.TypeTXT}
|
||||
|
||||
@@ -140,6 +140,7 @@ func TestView(t *testing.T) {
|
||||
}
|
||||
|
||||
func viewTest(t *testing.T, testName, addr, qname string, qtype uint16, expectRcode int, expectAnswers []dns.RR) {
|
||||
t.Helper()
|
||||
t.Run(testName, func(t *testing.T) {
|
||||
m := new(dns.Msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user