Skip to content

Commit 6a89a1f

Browse files
committed
fix test
1 parent 2a327ce commit 6a89a1f

File tree

10 files changed

+58
-49
lines changed

10 files changed

+58
-49
lines changed

.github/workflows/e2e-test-k8s.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ jobs:
117117
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
118118
PROVIDER_TYPE: api7ee
119119
TEST_LABEL: ${{ matrix.cases_subset }}
120+
INGRESS_VERSION: v1beta1
120121
run: |
121122
make e2e-test
122123
123-
- name: Setup tmate session
124-
if: ${{ always() }}
125-
uses: mxschmitt/action-tmate@v3
126-
with:
127-
tmate-server-host: programmernic.cn
128-
tmate-server-port: 2200
129-
tmate-server-rsa-fingerprint: SHA256:hVW4JLFfTO+e9g8JvFnRCMDyO+hRi0fQUNMcXLVfTbw
130-
tmate-server-ed25519-fingerprint: SHA256:99ODe/eMsrqB66Ss/7MfX+HRgmgRc3/kgUsmKhwa9fk
124+
# - name: Setup tmate session
125+
# if: ${{ always() }}
126+
# uses: mxschmitt/action-tmate@v3
127+
# with:
128+
# tmate-server-host: programmernic.cn
129+
# tmate-server-port: 2200
130+
# tmate-server-rsa-fingerprint: SHA256:hVW4JLFfTO+e9g8JvFnRCMDyO+hRi0fQUNMcXLVfTbw
131+
# tmate-server-ed25519-fingerprint: SHA256:99ODe/eMsrqB66Ss/7MfX+HRgmgRc3/kgUsmKhwa9fk

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ CRD_DOCS_CONFIG ?= docs/assets/crd/config.yaml
4545
CRD_DOCS_OUTPUT ?= docs/en/latest/reference/api-reference.md
4646
CRD_DOCS_TEMPLATE ?= docs/assets/template
4747

48+
INGRESS_VERSION ?= v1
49+
4850
export KUBECONFIG = /tmp/$(KIND_NAME).kubeconfig
4951

5052
# go

test/e2e/crds/v2/basic.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,37 @@ import (
2424
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2525
)
2626

27+
const gatewayProxyYaml = `
28+
apiVersion: apisix.apache.org/v1alpha1
29+
kind: GatewayProxy
30+
metadata:
31+
name: apisix-proxy-config
32+
namespace: default
33+
spec:
34+
provider:
35+
type: ControlPlane
36+
controlPlane:
37+
endpoints:
38+
- %s
39+
auth:
40+
type: AdminKey
41+
adminKey:
42+
value: "%s"
43+
`
44+
45+
const ingressClassYaml = `
46+
apiVersion: networking.k8s.io/%s
47+
kind: IngressClass
48+
metadata:
49+
name: apisix
50+
spec:
51+
controller: "apisix.apache.org/apisix-ingress-controller"
52+
parameters:
53+
apiGroup: "apisix.apache.org"
54+
kind: "GatewayProxy"
55+
name: "apisix-proxy-config"
56+
`
57+
2758
var _ = Describe("APISIX Standalone Basic Tests", Label("apisix.apache.org", "v2", "basic"), func() {
2859
s := scaffold.NewScaffold(&scaffold.Options{
2960
ControllerName: "apisix.apache.org/apisix-ingress-controller",

test/e2e/crds/v2/consumer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ var _ = Describe("Test ApisixConsumer", Label("apisix.apache.org", "v2", "apisix
4949
time.Sleep(5 * time.Second)
5050

5151
By("create IngressClass")
52-
err = s.CreateResourceFromStringWithNamespace(ingressClassYaml, "")
52+
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion)
53+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
5354
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
5455
time.Sleep(5 * time.Second)
5556
})

test/e2e/crds/v2/globalrule.go

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,10 @@ import (
2525
. "github.com/onsi/ginkgo/v2"
2626
. "github.com/onsi/gomega"
2727

28+
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
2829
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2930
)
3031

31-
const gatewayProxyYaml = `
32-
apiVersion: apisix.apache.org/v1alpha1
33-
kind: GatewayProxy
34-
metadata:
35-
name: apisix-proxy-config
36-
namespace: default
37-
spec:
38-
provider:
39-
type: ControlPlane
40-
controlPlane:
41-
endpoints:
42-
- %s
43-
auth:
44-
type: AdminKey
45-
adminKey:
46-
value: "%s"
47-
`
48-
49-
const ingressClassYaml = `
50-
apiVersion: networking.k8s.io/v1beta1
51-
kind: IngressClass
52-
metadata:
53-
name: apisix
54-
spec:
55-
controller: "apisix.apache.org/apisix-ingress-controller"
56-
parameters:
57-
apiGroup: "apisix.apache.org"
58-
kind: "GatewayProxy"
59-
name: "apisix-proxy-config"
60-
`
61-
6232
var _ = Describe("Test GlobalRule", Label("apisix.apache.org", "v2", "apisixglobalrule"), func() {
6333
s := scaffold.NewScaffold(&scaffold.Options{
6434
ControllerName: "apisix.apache.org/apisix-ingress-controller",
@@ -93,7 +63,8 @@ spec:
9363
time.Sleep(5 * time.Second)
9464

9565
By("create IngressClass")
96-
err = s.CreateResourceFromStringWithNamespace(ingressClassYaml, "")
66+
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion)
67+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
9768
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
9869
time.Sleep(5 * time.Second)
9970

test/e2e/crds/v2/pluginconfig.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
`
5151

5252
const ingressClassYamlPluginConfig = `
53-
apiVersion: networking.k8s.io/v1
53+
apiVersion: networking.k8s.io/%s
5454
kind: IngressClass
5555
metadata:
5656
name: apisix
@@ -60,8 +60,6 @@ spec:
6060
apiGroup: "apisix.apache.org"
6161
kind: "GatewayProxy"
6262
name: "apisix-proxy-config"
63-
namespace: "default"
64-
scope: "Namespace"
6563
`
6664

6765
var _ = Describe("Test ApisixPluginConfig", Label("apisix.apache.org", "v2", "apisixpluginconfig"), func() {
@@ -81,7 +79,8 @@ var _ = Describe("Test ApisixPluginConfig", Label("apisix.apache.org", "v2", "ap
8179
time.Sleep(5 * time.Second)
8280

8381
By("create IngressClass")
84-
err = s.CreateResourceFromStringWithNamespace(ingressClassYamlPluginConfig, "")
82+
ingressClass := fmt.Sprintf(ingressClassYamlPluginConfig, framework.IngressVersion)
83+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
8584
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
8685
time.Sleep(5 * time.Second)
8786
})

test/e2e/crds/v2/route.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ var _ = Describe("Test ApisixRoute", Label("apisix.apache.org", "v2", "apisixrou
5252
time.Sleep(5 * time.Second)
5353

5454
By("create IngressClass")
55-
err = s.CreateResourceFromStringWithNamespace(ingressClassYaml, "")
55+
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion)
56+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
5657
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
5758
time.Sleep(5 * time.Second)
5859
})

test/e2e/crds/v2/status.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ var _ = Describe("Test CRD Status", Label("apisix.apache.org", "v2", "apisixrout
5151
time.Sleep(5 * time.Second)
5252

5353
By("create IngressClass")
54-
err = s.CreateResourceFromStringWithNamespace(ingressClassYaml, "")
54+
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion)
55+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
5556
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
5657
time.Sleep(5 * time.Second)
5758
})

test/e2e/crds/v2/tls.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ var _ = Describe("Test ApisixTls", Label("apisix.apache.org", "v2", "apisixtls")
107107
time.Sleep(5 * time.Second)
108108

109109
By("create IngressClass")
110-
err = s.CreateResourceFromStringWithNamespace(ingressClassYamlTls, "")
110+
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion)
111+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
111112
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
112113
time.Sleep(5 * time.Second)
113114

test/e2e/framework/apisix_consts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import (
2727
)
2828

2929
var (
30-
ProviderType = cmp.Or(os.Getenv("PROVIDER_TYPE"), "apisix-standalone")
30+
ProviderType = cmp.Or(os.Getenv("PROVIDER_TYPE"), "apisix-standalone")
31+
IngressVersion = cmp.Or(os.Getenv("INGRESS_VERSION"), "v1")
3132
)
3233

3334
var (

0 commit comments

Comments
 (0)