@@ -36,50 +36,6 @@ var _ = Describe("Test Consumer", Label("apisix.apache.org", "v1alpha1", "consum
3636 err error
3737 )
3838
39- var defaultGatewayProxy = `
40- apiVersion: apisix.apache.org/v1alpha1
41- kind: GatewayProxy
42- metadata:
43- name: %s
44- spec:
45- provider:
46- type: ControlPlane
47- controlPlane:
48- endpoints:
49- - %s
50- auth:
51- type: AdminKey
52- adminKey:
53- value: "%s"
54- `
55-
56- var defaultGatewayClass = `
57- apiVersion: gateway.networking.k8s.io/v1
58- kind: GatewayClass
59- metadata:
60- name: %s
61- spec:
62- controllerName: %s
63- `
64-
65- var defaultGateway = `
66- apiVersion: gateway.networking.k8s.io/v1
67- kind: Gateway
68- metadata:
69- name: %s
70- spec:
71- gatewayClassName: %s
72- listeners:
73- - name: http1
74- protocol: HTTP
75- port: 80
76- infrastructure:
77- parametersRef:
78- group: apisix.apache.org
79- kind: GatewayProxy
80- name: %s
81- `
82-
8339 var defaultHTTPRoute = `
8440apiVersion: apisix.apache.org/v1alpha1
8541kind: PluginConfig
@@ -121,26 +77,23 @@ spec:
12177`
12278
12379 BeforeEach (func () {
124- gatewayName := s .Namespace ()
12580 By ("create GatewayProxy" )
126- gatewayProxyName := s .Namespace ()
127- err = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (defaultGatewayProxy , gatewayProxyName , s .Deployer .GetAdminEndpoint (), s .AdminKey ()), s .Namespace ())
81+ err = s .CreateResourceFromString (s .GetGatewayProxySpec ())
12882 Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
12983 time .Sleep (time .Second )
13084
13185 By ("create GatewayClass" )
132- gatewayClassName := s .Namespace ()
133- err = s .CreateResourceFromString (fmt .Sprintf (defaultGatewayClass , gatewayClassName , s .GetControllerName ()))
86+ err = s .CreateResourceFromString (s .GetGatewayClassYaml ())
13487 Expect (err ).NotTo (HaveOccurred (), "creating GatewayClass" )
13588 time .Sleep (time .Second )
13689
13790 By ("create Gateway" )
138- err = s .CreateResourceFromStringWithNamespace ( fmt . Sprintf ( defaultGateway , gatewayName , gatewayClassName , gatewayProxyName ), s . Namespace ())
91+ err = s .CreateResourceFromString ( s . GetGatewayYaml ())
13992 Expect (err ).NotTo (HaveOccurred (), "creating Gateway" )
14093 time .Sleep (time .Second )
14194
14295 By ("create HTTPRoute" )
143- s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, fmt .Sprintf (defaultHTTPRoute , gatewayName ))
96+ s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, fmt .Sprintf (defaultHTTPRoute , s . Namespace () ))
14497 })
14598
14699 Context ("Consumer plugins" , func () {
@@ -522,7 +475,7 @@ spec:
522475apiVersion: apisix.apache.org/v1alpha1
523476kind: GatewayProxy
524477metadata:
525- name: %s
478+ name: apisix-proxy-config
526479spec:
527480 provider:
528481 type: ControlPlane
@@ -575,7 +528,7 @@ spec:
575528 })
576529
577530 By ("update GatewayProxy with new admin key" )
578- updatedProxy := fmt .Sprintf (updatedGatewayProxy , s .Namespace (), s . Deployer .GetAdminEndpoint (resources .DataplaneService ), resources .AdminAPIKey )
531+ updatedProxy := fmt .Sprintf (updatedGatewayProxy , s .Deployer .GetAdminEndpoint (resources .DataplaneService ), resources .AdminAPIKey )
579532 err = s .CreateResourceFromStringWithNamespace (updatedProxy , s .Namespace ())
580533 Expect (err ).NotTo (HaveOccurred (), "updating GatewayProxy" )
581534
0 commit comments