Skip to content

Commit 725ca7a

Browse files
committed
fix test
1 parent d5fe3e0 commit 725ca7a

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

internal/controller/apisixroute_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func (r *ApisixRouteReconciler) validatePluginConfig(tctx *provider.TranslateCon
314314
Version: r.ICGV.Version,
315315
Kind: types.KindIngressClass,
316316
})
317-
if err := r.Get(ctx, client.ObjectKey{Name: pc.Spec.IngressClassName}, ic); err != nil {
317+
if err := r.Get(tctx, client.ObjectKey{Name: pc.Spec.IngressClassName}, ic); err != nil {
318318
return types.ReasonError{
319319
Reason: string(apiv2.ConditionReasonInvalidSpec),
320320
Message: fmt.Sprintf("failed to get IngressClass %s for ApisixPluginConfig %s: %v", pc.Spec.IngressClassName, pcNN, err),

test/e2e/crds/v2/streamroute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Test ApisixRoute With StreamRoute", Label("apisix.apache.org",
3737
Skip("only support APISIX provider")
3838
}
3939
By("create GatewayProxy")
40-
gatewayProxy := s.GetGatewayProxyYaml()
40+
gatewayProxy := s.GetGatewayProxySpec()
4141
err := s.CreateResourceFromString(gatewayProxy)
4242
Expect(err).NotTo(HaveOccurred(), "creating GatewayProxy")
4343
time.Sleep(5 * time.Second)

test/e2e/scaffold/k8s.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,60 @@ func (s *Scaffold) WaitUntilDeploymentAvailable(name string) {
319319
k8s.WaitUntilDeploymentAvailable(s.GinkgoT, s.kubectlOptions, name, 10, 10*time.Second)
320320
}
321321

322+
const ingressClassYaml = `
323+
apiVersion: networking.k8s.io/%s
324+
kind: IngressClass
325+
metadata:
326+
name: %s
327+
annotations:
328+
apisix.apache.org/parameters-namespace: %s
329+
spec:
330+
controller: %s
331+
parameters:
332+
apiGroup: "apisix.apache.org"
333+
kind: "GatewayProxy"
334+
name: "apisix-proxy-config"
335+
`
336+
337+
func (s *Scaffold) GetIngressClassYaml() string {
338+
return fmt.Sprintf(ingressClassYaml, framework.IngressVersion, s.Namespace(), s.Namespace(), s.GetControllerName())
339+
}
340+
341+
const gatewayClassYaml = `
342+
apiVersion: gateway.networking.k8s.io/v1
343+
kind: GatewayClass
344+
metadata:
345+
name: %s
346+
spec:
347+
controllerName: %s
348+
`
349+
350+
func (s *Scaffold) GetGatewayClassYaml() string {
351+
return fmt.Sprintf(gatewayClassYaml, s.Namespace(), s.GetControllerName())
352+
}
353+
354+
const gatewayYaml = `
355+
apiVersion: gateway.networking.k8s.io/v1
356+
kind: Gateway
357+
metadata:
358+
name: %s
359+
spec:
360+
gatewayClassName: %s
361+
listeners:
362+
- name: http1
363+
protocol: HTTP
364+
port: 80
365+
infrastructure:
366+
parametersRef:
367+
group: apisix.apache.org
368+
kind: GatewayProxy
369+
name: apisix-proxy-config
370+
`
371+
372+
func (s *Scaffold) GetGatewayYaml() string {
373+
return fmt.Sprintf(gatewayYaml, s.Namespace(), s.Namespace())
374+
}
375+
322376
func (s *Scaffold) RunDigDNSClientFromK8s(args ...string) (string, error) {
323377
kubectlArgs := []string{
324378
"run",

0 commit comments

Comments
 (0)