@@ -316,25 +316,35 @@ var _ = framework.Describe("[group:kubectl-ko]", func() {
316316 pod = podClient .CreateSync (pod )
317317
318318 ginkgo .By ("Checking trace output" )
319+ var traceService bool
319320 subCmd := "ovn-trace"
320321 if f .VersionPriorTo (1 , 12 ) {
321322 subCmd = "trace"
322323 }
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 ))
324326 checkFunc := func (output string ) {
325327 ginkgo .GinkgoHelper ()
328+ var match string
329+ if traceService && f .VersionPriorTo (1 , 11 ) && f .IsUnderlay () {
330+ match = matchLocalnet
331+ } else {
332+ match = matchPod
333+ }
326334 if subCmd == "ovn-trace" {
327335 lines := strings .Split (strings .TrimSpace (output ), "\n " )
328- framework .ExpectContainSubstring (lines [len (lines )- 1 ], outputMatch )
336+ framework .ExpectContainSubstring (lines [len (lines )- 1 ], match )
329337 } else {
330- framework .ExpectContainSubstring (output , outputMatch )
338+ framework .ExpectContainSubstring (output , match )
331339 }
332340 }
333341 for protocol , port := range map [corev1.Protocol ]int32 {corev1 .ProtocolTCP : tcpPort , corev1 .ProtocolUDP : udpPort } {
334342 proto := strings .ToLower (string (protocol ))
343+ traceService = false
335344 for _ , ip := range pod2 .Status .PodIPs {
336345 execOrDie (fmt .Sprintf ("ko %s %s/%s %s %s %d" , subCmd , pod .Namespace , pod .Name , ip .IP , proto , port ), checkFunc )
337346 }
347+ traceService = true
338348 for _ , ip := range service .Spec .ClusterIPs {
339349 execOrDie (fmt .Sprintf ("ko %s %s/%s %s %s %d" , subCmd , pod .Namespace , pod .Name , ip , proto , port ), checkFunc )
340350 }
0 commit comments