@@ -64,47 +64,13 @@ var _ = Describe("APISIX Standalone Basic Tests", Label("apisix.apache.org", "v2
6464
6565 Context ("IngressClass Annotations" , func () {
6666 It ("Basic tests" , func () {
67- const gatewayProxyYaml = `
68- apiVersion: apisix.apache.org/v1alpha1
69- kind: GatewayProxy
70- metadata:
71- name: apisix-proxy-config
72- spec:
73- provider:
74- type: ControlPlane
75- controlPlane:
76- endpoints:
77- - %s
78- auth:
79- type: AdminKey
80- adminKey:
81- value: "%s"
82- `
83-
84- const ingressClassYaml = `
85- apiVersion: networking.k8s.io/%s
86- kind: IngressClass
87- metadata:
88- name: apisix
89- annotations:
90- apisix.apache.org/parameters-namespace: %s
91- spec:
92- controller: apisix.apache.org/apisix-ingress-controller
93- parameters:
94- apiGroup: apisix.apache.org
95- kind: GatewayProxy
96- name: apisix-proxy-config
97- `
98-
9967 By ("create GatewayProxy" )
100- gatewayProxy := fmt .Sprintf (gatewayProxyYaml , s .Deployer .GetAdminEndpoint (), s .AdminKey ())
101- err := s .CreateResourceFromString (gatewayProxy )
68+ err := s .CreateResourceFromString (s .GetGatewayProxySpec ())
10269 Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
10370 time .Sleep (5 * time .Second )
10471
10572 By ("create IngressClass" )
106- ingressClass := fmt .Sprintf (ingressClassYaml , framework .IngressVersion , s .Namespace ())
107- err = s .CreateResourceFromStringWithNamespace (ingressClass , "" )
73+ err = s .CreateResourceFromStringWithNamespace (s .GetIngressClassYaml (), "" )
10874 Expect (err ).NotTo (HaveOccurred (), "creating IngressClass" )
10975 time .Sleep (5 * time .Second )
11076
@@ -114,7 +80,7 @@ kind: ApisixRoute
11480metadata:
11581 name: default
11682spec:
117- ingressClassName: apisix
83+ ingressClassName: %s
11884 http:
11985 - name: rule0
12086 match:
@@ -132,13 +98,13 @@ spec:
13298
13399 By ("apply ApisixRoute" )
134100 var apisixRoute apiv2.ApisixRoute
135- applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , "/get" ))
101+ applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , s . Namespace (), "/get" ))
136102
137103 By ("verify ApisixRoute works" )
138104 Eventually (request ).WithArguments ("/get" ).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusOK ))
139105
140106 By ("update ApisixRoute" )
141- applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , "/headers" ))
107+ applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , s . Namespace (), "/headers" ))
142108 Eventually (request ).WithArguments ("/get" ).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusNotFound ))
143109 s .RequestAssert (& scaffold.RequestAssert {
144110 Method : "GET" ,
0 commit comments