dovics commented on PR #2780:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2780#issuecomment-4627671069

   add regression tests
   
   before fix
   ```
   go test -v ./internal/adc/translator/ -run 
TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations
   === RUN   TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations
   --- FAIL: TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations 
(0.00s)
   panic: runtime error: invalid memory address or nil pointer dereference 
[recovered, repanicked]
   [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x1500c62]
   
   goroutine 54 [running]:
   testing.tRunner.func1.2({0x16aec40, 0x27d5fd0})
           /usr/local/go/src/testing/testing.go:1872 +0x237
   testing.tRunner.func1()
           /usr/local/go/src/testing/testing.go:1875 +0x35b
   panic({0x16aec40?, 0x27d5fd0?})
           /usr/local/go/src/runtime/panic.go:783 +0x132
   
github.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).buildRouteFromIngressPath(0xc0001b1200,
 0xc0000a4cd8, 0xc000204f20, 0xc0001b12c0, 0x0, {0xc000014310, 0x3}, 
0xc0001b1290)
           
/home/dovics/workspace/insightst/apisix-ingress-controller/internal/adc/translator/ingress.go:285
 +0x342
   
github.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).buildServiceFromIngressPath(0xc0001b1200,
 0xc00043bcd8, 0xc000204f20, 0x0, 0xc0001b12c0, {0xc000014310, 0x3}, 
{0xc0002a38d0, 0x1, 0x1}, ...)
           
/home/dovics/workspace/insightst/apisix-ingress-controller/internal/adc/translator/ingress.go:165
 +0x33e
   
github.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).TranslateIngress(0xc0001b1200,
 0xc00043bcd8, 0xc000204f20)
           
/home/dovics/workspace/insightst/apisix-ingress-controller/internal/adc/translator/ingress.go:107
 +0x49a
   
github.com/apache/apisix-ingress-controller/internal/adc/translator.TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations(0xc0000d8c40)
           
/home/dovics/workspace/insightst/apisix-ingress-controller/internal/adc/translator/ingress_test.go:71
 +0x37a
   testing.tRunner(0xc0000d8c40, 0x19a9e00)
           /usr/local/go/src/testing/testing.go:1934 +0xea
   created by testing.(*T).Run in goroutine 1
           /usr/local/go/src/testing/testing.go:1997 +0x465
   FAIL    github.com/apache/apisix-ingress-controller/internal/adc/translator  
   0.020s
   FAIL
   ```
   
   after fix
   ```
   go test -v ./internal/adc/translator/ -run 
TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations
   === RUN   TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations
   --- PASS: TestTranslateIngress_ImplementationSpecificPathWithoutAnnotations 
(0.00s)
   PASS
   ok      github.com/apache/apisix-ingress-controller/internal/adc/translator  
   0.019s
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to