@@ -316,25 +316,35 @@ var _ = framework.Describe("[group:kubectl-ko]", func() {
316
316
pod = podClient .CreateSync (pod )
317
317
318
318
ginkgo .By ("Checking trace output" )
319
+ var traceService bool
319
320
subCmd := "ovn-trace"
320
321
if f .VersionPriorTo (1 , 12 ) {
321
322
subCmd = "trace"
322
323
}
323
- outputMatch := fmt .Sprintf ("output to %q" , ovs .PodNameToPortName (pod2Name , pod2 .Namespace , util .OvnProvider ))
324
+ matchPod := fmt .Sprintf ("output to %q" , ovs .PodNameToPortName (pod2Name , pod2 .Namespace , util .OvnProvider ))
325
+ matchLocalnet := fmt .Sprintf ("output to %q" , fmt .Sprintf ("localnet.%s" , util .DefaultSubnet ))
324
326
checkFunc := func (output string ) {
325
327
ginkgo .GinkgoHelper ()
328
+ var match string
329
+ if traceService && f .VersionPriorTo (1 , 11 ) && f .IsUnderlay () {
330
+ match = matchLocalnet
331
+ } else {
332
+ match = matchPod
333
+ }
326
334
if subCmd == "ovn-trace" {
327
335
lines := strings .Split (strings .TrimSpace (output ), "\n " )
328
- framework .ExpectContainSubstring (lines [len (lines )- 1 ], outputMatch )
336
+ framework .ExpectContainSubstring (lines [len (lines )- 1 ], match )
329
337
} else {
330
- framework .ExpectContainSubstring (output , outputMatch )
338
+ framework .ExpectContainSubstring (output , match )
331
339
}
332
340
}
333
341
for protocol , port := range map [corev1.Protocol ]int32 {corev1 .ProtocolTCP : tcpPort , corev1 .ProtocolUDP : udpPort } {
334
342
proto := strings .ToLower (string (protocol ))
343
+ traceService = false
335
344
for _ , ip := range pod2 .Status .PodIPs {
336
345
execOrDie (fmt .Sprintf ("ko %s %s/%s %s %s %d" , subCmd , pod .Namespace , pod .Name , ip .IP , proto , port ), checkFunc )
337
346
}
347
+ traceService = true
338
348
for _ , ip := range service .Spec .ClusterIPs {
339
349
execOrDie (fmt .Sprintf ("ko %s %s/%s %s %s %d" , subCmd , pod .Namespace , pod .Name , ip , proto , port ), checkFunc )
340
350
}
0 commit comments