@@ -867,28 +867,10 @@ spec:
867867 name: httpbin-service-e2e-test
868868 port:
869869 number: 80
870- `
871- const ingressSpec2 = `
872- apiVersion: networking.k8s.io/v1
873- kind: Ingress
874- metadata:
875- name: api7-ingress
876- spec:
877- ingressClassName: api7-ingress-class
878- rules:
879- - host: ingress.example.com
880- http:
881- paths:
882- - path: /put
883- pathType: Prefix
884- backend:
885- service:
886- name: httpbin-service-e2e-test
887- port:
888- number: 80
889870`
890871 var (
891- err error
872+ additionalGatewayGroupID string
873+ err error
892874 )
893875
894876 It ("GatewayProxy reference Secret" , func () {
@@ -917,35 +899,31 @@ spec:
917899 }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).
918900 Should (Equal (http .StatusOK ))
919901
920- // update gateway group admin-key
921- adminKey := s .GetAdminKey (s .CurrentGatewayGroupID ())
902+ By ("create additional gateway group to get new admin key" )
903+ additionalGatewayGroupID , _ , err = s .CreateAdditionalGatewayGroup ("gateway-proxy-update" )
904+ Expect (err ).NotTo (HaveOccurred (), "creating additional gateway group" )
905+
906+ client , err := s .NewAPISIXClientForGatewayGroup (additionalGatewayGroupID )
907+ Expect (err ).NotTo (HaveOccurred (), "creating APISIX client for additional gateway group" )
922908
923- // should fail to request provider service and get 401 because the admin-key is changed
924- By ("create Ingress" )
925- err = s .CreateResourceFromStringWithNamespace (ingressSpec2 , s .Namespace ())
926- s .WaitControllerManagerLog ("Request failed with status code 401" , 0 , 10 * time .Second )
909+ By ("Ingress not found for additional gateway group" )
910+ client .
911+ GET ("/get" ).
912+ WithHost ("ingress.example.com" ).
913+ Expect ().
914+ Status (http .StatusNotFound )
927915
928- // the new Ingress should not work consistently
929- Consistently (func () int {
930- return s .NewAPISIXClient ().
931- GET ("/put" ).
932- WithHost ("ingress.example.com" ).
933- Expect ().Raw ().StatusCode
934- }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).
935- Should (Equal (http .StatusNotFound ))
916+ resources , exists := s .GetAdditionalGatewayGroup (additionalGatewayGroupID )
917+ Expect (exists ).To (BeTrue (), "additional gateway group should exist" )
936918
937919 By ("update secret" )
938- err = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (secretSpec , base64 .StdEncoding .EncodeToString ([]byte (adminKey ))), s .Namespace ())
920+ err = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (secretSpec , base64 .StdEncoding .EncodeToString ([]byte (resources . AdminAPIKey ))), s .Namespace ())
939921 Expect (err ).NotTo (HaveOccurred (), "creating secret" )
940922
941- By ("create Ingress again" )
942- err = s .CreateResourceFromStringWithNamespace (ingressSpec2 , s .Namespace ())
943- Expect (err ).NotTo (HaveOccurred (), "creating Ingress with path prefix /put" )
944-
945- By ("verify Ingress works" )
923+ By ("verify Ingress works for additional gateway group" )
946924 Eventually (func () int {
947- return s . NewAPISIXClient () .
948- PUT ("/put " ).
925+ return client .
926+ GET ("/get " ).
949927 WithHost ("ingress.example.com" ).
950928 Expect ().Raw ().StatusCode
951929 }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).
0 commit comments