@@ -7,12 +7,30 @@ import (
77 . "github.com/onsi/ginkgo/v2"
88 . "github.com/onsi/gomega"
99
10+ "github.com/api7/api7-ingress-controller/test/e2e/framework"
1011 "github.com/api7/api7-ingress-controller/test/e2e/scaffold"
1112)
1213
1314var _ = Describe ("Test Consumer" , func () {
1415 s := scaffold .NewDefaultScaffold ()
1516
17+ var gatewayProxyYaml = `
18+ apiVersion: gateway.apisix.io/v1alpha1
19+ kind: GatewayProxy
20+ metadata:
21+ name: api7-proxy-config
22+ spec:
23+ provider:
24+ type: ControlPlane
25+ controlPlane:
26+ endpoints:
27+ - %s
28+ auth:
29+ type: AdminKey
30+ adminKey:
31+ value: "%s"
32+ `
33+
1634 var defaultGatewayClass = `
1735apiVersion: gateway.networking.k8s.io/v1
1836kind: GatewayClass
3351 - name: http1
3452 protocol: HTTP
3553 port: 80
54+ infrastructure:
55+ parametersRef:
56+ group: gateway.apisix.io
57+ kind: GatewayProxy
58+ name: api7-proxy-config
3659`
3760
3861 var defaultHTTPRoute = `
6790 filters:
6891 - type: ExtensionRef
6992 extensionRef:
70- group: gateway.api7 .io
93+ group: gateway.apisix .io
7194 kind: PluginConfig
7295 name: auth-plugin-config
7396 backendRefs:
@@ -76,10 +99,16 @@ spec:
7699`
77100
78101 var beforeEachHTTP = func () {
102+ By ("create GatewayProxy" )
103+ gatewayProxy := fmt .Sprintf (gatewayProxyYaml , framework .DashboardTLSEndpoint , s .AdminKey ())
104+ err := s .CreateResourceFromString (gatewayProxy )
105+ Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
106+ time .Sleep (5 * time .Second )
107+
79108 By ("create GatewayClass" )
80109 gatewayClassName := fmt .Sprintf ("api7-%d" , time .Now ().Unix ())
81110 gatewayString := fmt .Sprintf (defaultGatewayClass , gatewayClassName , s .GetControllerName ())
82- err : = s .CreateResourceFromStringWithNamespace (gatewayString , "" )
111+ err = s .CreateResourceFromStringWithNamespace (gatewayString , "" )
83112 Expect (err ).NotTo (HaveOccurred (), "creating GatewayClass" )
84113 time .Sleep (5 * time .Second )
85114
@@ -187,7 +216,8 @@ spec:
187216 })
188217
189218 Context ("Credential" , func () {
190- var defaultCredential = `apiVersion: gateway.apisix.io/v1alpha1
219+ var defaultCredential = `
220+ apiVersion: gateway.apisix.io/v1alpha1
191221kind: Consumer
192222metadata:
193223 name: consumer-sample
0 commit comments