Skip to content

Commit 4f6b97c

Browse files
committed
add case without explicit dns server
remove checking for answer string as it only appears in non authoritative dns responses
1 parent 3591a97 commit 4f6b97c

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

test/integration/lrp/lrp_fqdn_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ func TestLRPFQDN(t *testing.T) {
5252
countIncreases bool
5353
}{
5454
{
55-
name: "nslookup google succeeds",
56-
command: []string{"nslookup", "www.google.com", "10.0.0.10"},
57-
expectedMsgContains: "answer:",
58-
countIncreases: true,
59-
shouldError: false,
55+
name: "nslookup google succeeds",
56+
command: []string{"nslookup", "www.google.com", "10.0.0.10"},
57+
countIncreases: true,
58+
shouldError: false,
59+
},
60+
{
61+
name: "nslookup google succeeds without explicit dns server",
62+
command: []string{"nslookup", "www.google.com"},
63+
countIncreases: true,
64+
shouldError: false,
6065
},
6166
{
6267
name: "wget google succeeds",
@@ -66,11 +71,10 @@ func TestLRPFQDN(t *testing.T) {
6671
shouldError: false,
6772
},
6873
{
69-
name: "nslookup bing succeeds",
70-
command: []string{"nslookup", "www.bing.com", "10.0.0.10"},
71-
expectedMsgContains: "answer:",
72-
countIncreases: true,
73-
shouldError: false,
74+
name: "nslookup bing succeeds",
75+
command: []string{"nslookup", "www.bing.com", "10.0.0.10"},
76+
countIncreases: true,
77+
shouldError: false,
7478
},
7579
{
7680
name: "wget bing fails but dns succeeds",

test/integration/lrp/lrp_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ func testLRPCase(t *testing.T, ctx context.Context, clientPod corev1.Pod, client
174174
t.Log("calling command from client")
175175

176176
val, errMsg, err := kubernetes.ExecCmdOnPod(ctx, cs, clientPod.Namespace, clientPod.Name, clientContainer, clientCmd, config, false)
177-
178-
require.Contains(t, string(val), expectResponse)
179-
require.Contains(t, string(errMsg), expectErrMsg)
180177
if shouldError {
181178
require.Error(t, err)
182179
} else {
183180
require.NoError(t, err)
184181
}
185182

183+
require.Contains(t, string(val), expectResponse)
184+
require.Contains(t, string(errMsg), expectErrMsg)
185+
186186
// in case there is time to propagate
187187
time.Sleep(500 * time.Millisecond)
188188

@@ -212,7 +212,7 @@ func TestLRP(t *testing.T) {
212212

213213
testLRPCase(t, ctx, *selectedPod, []string{
214214
"nslookup", "google.com", "10.0.0.10",
215-
}, "Server:", "", false, true)
215+
}, "", "", false, true)
216216
}
217217

218218
// TakeOne takes one item from the slice randomly; if empty, it returns the empty value for the type

0 commit comments

Comments
 (0)