@@ -16,6 +16,23 @@ import (
1616var _ = Describe ("Test HTTPRoute" , func () {
1717 s := scaffold .NewDefaultScaffold ()
1818
19+ var gatewayProxyYaml = `
20+ apiVersion: gateway.apisix.io/v1alpha1
21+ kind: GatewayProxy
22+ metadata:
23+ name: api7-proxy-config
24+ spec:
25+ provider:
26+ type: ControlPlane
27+ controlPlane:
28+ endpoints:
29+ - %s
30+ auth:
31+ type: AdminKey
32+ adminKey:
33+ value: "%s"
34+ `
35+
1936 var defautlGatewayClass = `
2037apiVersion: gateway.networking.k8s.io/v1
2138kind: GatewayClass
3653 - name: http1
3754 protocol: HTTP
3855 port: 80
56+ infrastructure:
57+ parametersRef:
58+ group: gateway.apisix.io
59+ kind: GatewayProxy
60+ name: api7-proxy-config
3961`
4062 var defautlGatewayHTTPS = `
4163apiVersion: gateway.networking.k8s.io/v1
5476 - kind: Secret
5577 group: ""
5678 name: test-apisix-tls
79+ infrastructure:
80+ parametersRef:
81+ group: gateway.apisix.io
82+ kind: GatewayProxy
83+ name: api7-proxy-config
5784`
5885
5986 var ResourceApplied = func (resourType , resourceName , resourceRaw string , observedGeneration int ) {
@@ -76,9 +103,15 @@ spec:
76103 }
77104
78105 var beforeEachHTTP = func () {
106+ By ("create GatewayProxy" )
107+ gatewayProxy := fmt .Sprintf (gatewayProxyYaml , framework .DashboardTLSEndpoint , s .AdminKey ())
108+ err := s .CreateResourceFromString (gatewayProxy )
109+ Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
110+ time .Sleep (5 * time .Second )
111+
79112 By ("create GatewayClass" )
80113 gatewayClassName := fmt .Sprintf ("api7-%d" , time .Now ().Unix ())
81- err : = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (defautlGatewayClass , gatewayClassName , s .GetControllerName ()), "" )
114+ err = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (defautlGatewayClass , gatewayClassName , s .GetControllerName ()), "" )
82115 Expect (err ).NotTo (HaveOccurred (), "creating GatewayClass" )
83116 time .Sleep (5 * time .Second )
84117
@@ -101,11 +134,17 @@ spec:
101134 }
102135
103136 var beforeEachHTTPS = func () {
137+ By ("create GatewayProxy" )
138+ gatewayProxy := fmt .Sprintf (gatewayProxyYaml , framework .DashboardTLSEndpoint , s .AdminKey ())
139+ err := s .CreateResourceFromString (gatewayProxy )
140+ Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
141+ time .Sleep (5 * time .Second )
142+
104143 secretName := _secretName
105144 createSecret (s , secretName )
106145 By ("create GatewayClass" )
107146 gatewayClassName := fmt .Sprintf ("api7-%d" , time .Now ().Unix ())
108- err : = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (defautlGatewayClass , gatewayClassName , s .GetControllerName ()), "" )
147+ err = s .CreateResourceFromStringWithNamespace (fmt .Sprintf (defautlGatewayClass , gatewayClassName , s .GetControllerName ()), "" )
109148 Expect (err ).NotTo (HaveOccurred (), "creating GatewayClass" )
110149 time .Sleep (5 * time .Second )
111150
0 commit comments