Skip to content

Commit d7f500f

Browse files
committed
fix: consumer test case
Signed-off-by: ashing <[email protected]>
1 parent a15337e commit d7f500f

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

test/e2e/crds/consumer.go

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1314
var _ = 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 = `
1735
apiVersion: gateway.networking.k8s.io/v1
1836
kind: GatewayClass
@@ -33,6 +51,11 @@ spec:
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 = `
@@ -67,7 +90,7 @@ spec:
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
191221
kind: Consumer
192222
metadata:
193223
name: consumer-sample

test/e2e/gatewayapi/httproute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ spec:
655655
filters:
656656
- type: ExtensionRef
657657
extensionRef:
658-
group: gateway.api7.io
658+
group: gateway.apisix.io
659659
kind: PluginConfig
660660
name: example-plugin-config
661661
backendRefs:

0 commit comments

Comments
 (0)