Skip to content

Commit ddb8b77

Browse files
author
wafuwafu13
committed
remove local_only
1 parent bb75370 commit ddb8b77

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

check-dns/lib/check_dns_test.go

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,70 +27,65 @@ func TestCheckDns(t *testing.T) {
2727
args []string
2828
want_status checkers.Status
2929
want_msg string
30-
local_only bool
3130
}{
3231
{
3332
[]string{"-H", "example.com"},
3433
checkers.OK,
3534
"status: NOERROR",
36-
true,
3735
},
3836
{
3937
[]string{"-H", "example.com", "--norec"},
4038
checkers.OK,
4139
"status: NOERROR",
42-
true,
4340
},
4441
{
4542
[]string{"-H", "exampleeeee.com"},
4643
checkers.CRITICAL,
4744
"status: NXDOMAIN",
48-
true,
4945
},
5046
{
5147
[]string{"-H", "example.com", "-s", "8.8.8.8"},
5248
checkers.OK,
5349
"status: NOERROR",
54-
false,
5550
},
5651
{
5752
[]string{"-H", "exampleeeee.com", "-s", "8.8.8.8"},
5853
checkers.CRITICAL,
5954
"status: NXDOMAIN",
60-
false,
55+
},
56+
{
57+
[]string{"-H", "exampleeeee.com", "-s", "8.8.8"},
58+
checkers.CRITICAL,
59+
"timeout",
6160
},
6261
{
6362
[]string{"-H", "jprs.co.jp", "-s", "202.11.16.49", "--norec"},
6463
checkers.OK,
6564
"status: NOERROR",
66-
false,
6765
},
6866
{
6967
[]string{"-H", "www.google.com", "-s", "202.11.16.49", "--norec"},
7068
checkers.CRITICAL,
7169
"status: REFUSED",
72-
false,
7370
},
7471
}
7572

7673
for i, tt := range tests {
7774
t.Logf("=== Start #%d", i)
78-
// when runs without setting server in CI, status will be REFUSED
79-
if tt.local_only && os.Getenv("RUN_TEST_ON_GITHUB_ACTIONS") == "1" {
80-
continue
81-
}
8275
opts, err := parseArgs(tt.args)
8376
if err != nil {
8477
t.Fatal(err)
8578
}
79+
// when runs without setting server in CI, status will be REFUSED
80+
if opts.Server == "" && os.Getenv("RUN_TEST_ON_GITHUB_ACTIONS") == "1" {
81+
continue
82+
}
8683
ckr := opts.run()
8784

8885
assert.Equal(t, tt.want_status, ckr.Status)
8986

90-
if tt.want_msg != "" {
91-
if !strings.Contains(ckr.Message, tt.want_msg) {
92-
t.Errorf("%s is not incleded in message", tt.want_msg)
93-
}
87+
if !strings.Contains(ckr.Message, tt.want_msg) {
88+
t.Errorf("%s is not incleded in message", tt.want_msg)
9489
}
9590
}
9691
}

0 commit comments

Comments
 (0)