Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
4842859
chore: refactor E2E tests to support parallel tests
Revolyssup Jul 31, 2025
c2340e5
fix ci
Revolyssup Jul 31, 2025
0fe8b52
install ginkgo
Revolyssup Jul 31, 2025
bbadbbd
Merge branch 'master' of github.com:apache/apisix-ingress-controller …
Revolyssup Jul 31, 2025
f3b6bf8
fix
Revolyssup Aug 1, 2025
835a81d
fix
Revolyssup Aug 1, 2025
d164ae8
fix
Revolyssup Aug 1, 2025
e7ec20a
fix ingress test
Revolyssup Aug 1, 2025
26ada20
fix tls
Revolyssup Aug 1, 2025
6afab7e
fix tls
Revolyssup Aug 1, 2025
9dcb4ef
fix
Revolyssup Aug 1, 2025
0741306
fix
Revolyssup Aug 1, 2025
7b28f3b
fix ing
Revolyssup Aug 4, 2025
1906033
fix ing
Revolyssup Aug 4, 2025
79600b4
fix ing
Revolyssup Aug 4, 2025
2f17c77
pause ingress tests
Revolyssup Aug 4, 2025
91feeaf
fix consumer
Revolyssup Aug 4, 2025
badb102
pause defaultingress tests
Revolyssup Aug 4, 2025
be9929a
fix
Revolyssup Aug 4, 2025
4f3edb0
fix lint
Revolyssup Aug 4, 2025
c3f8dbb
fix lint
Revolyssup Aug 4, 2025
7e0c971
fix
Revolyssup Aug 5, 2025
0ab4fdc
fix
Revolyssup Aug 5, 2025
19cd878
fix
Revolyssup Aug 5, 2025
8f33813
fix lint
Revolyssup Aug 5, 2025
7b35de6
fix status
Revolyssup Aug 5, 2025
0b229bb
increase timeout
Revolyssup Aug 5, 2025
a9aee63
pause httproute test
Revolyssup Aug 5, 2025
4130ac0
run httproute serially
Revolyssup Aug 5, 2025
05b989c
fix lint and separate out httproute tests
Revolyssup Aug 5, 2025
1c58561
run 32 tests only
Revolyssup Aug 6, 2025
904e129
Merge branch 'master' of github.com:apache/apisix-ingress-controller …
Revolyssup Aug 6, 2025
8f7c181
rm
Revolyssup Aug 6, 2025
a1e5974
reduce tests
Revolyssup Aug 6, 2025
f11b3c7
use unique gatewayproxy name
Revolyssup Aug 6, 2025
513f255
increase time for accepting
Revolyssup Aug 6, 2025
6bce11a
increase gap between rq to api server
Revolyssup Aug 6, 2025
c975b1d
add sleep
Revolyssup Aug 6, 2025
fd76b09
fix controllername in httproute test
Revolyssup Aug 6, 2025
67caaf3
run all tests
Revolyssup Aug 6, 2025
6279ee5
fix route.go
Revolyssup Aug 7, 2025
e8bff71
add sleep in crd
Revolyssup Aug 7, 2025
940fe22
run only failed tests
Revolyssup Aug 7, 2025
17e3faf
fix
Revolyssup Aug 7, 2025
6b6dc55
fix long name
Revolyssup Aug 7, 2025
30ba121
run only failing tests
Revolyssup Aug 7, 2025
76d080f
fix
Revolyssup Aug 7, 2025
cfef33d
only wait for pod when non zero replica
Revolyssup Aug 7, 2025
3c21b08
tunnel only when replica>0
Revolyssup Aug 7, 2025
9339785
remove redundant file
Revolyssup Aug 7, 2025
6d5f7f2
fix
Revolyssup Aug 7, 2025
a67d6b5
fix
Revolyssup Aug 7, 2025
f0b1b01
decrease timeout at places and enable standalone tests
Revolyssup Aug 7, 2025
fcef3fd
use 4 nodes
Revolyssup Aug 8, 2025
dcad5b1
add label filter
Revolyssup Aug 8, 2025
9bb7169
remove sleep
Revolyssup Aug 8, 2025
d327d42
remove pause from tests
Revolyssup Aug 8, 2025
8ff0cb4
remove redundant createresourcefromstringwithnamespace
Revolyssup Aug 8, 2025
fc3f4c0
apply copilot suggestion
Revolyssup Aug 8, 2025
470c6eb
apply suggestions
Revolyssup Aug 8, 2025
89646cc
apply sug
Revolyssup Aug 8, 2025
6375c58
Revert "apply sug"
Revolyssup Aug 9, 2025
6e579f1
Revert "apply suggestions"
Revolyssup Aug 9, 2025
9c1babf
use make install-ginkgo
Revolyssup Aug 9, 2025
f73fffb
increase timeout
Revolyssup Aug 9, 2025
9b715d0
increase timeout
Revolyssup Aug 9, 2025
cd7034b
Merge branch 'master' of github.com:apache/apisix-ingress-controller …
Revolyssup Aug 11, 2025
097efb1
use default scaffold
Revolyssup Aug 11, 2025
c4eb985
apply suggestions
Revolyssup Aug 11, 2025
c856c8f
revert default scaffold
Revolyssup Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/apisix-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ jobs:
with:
go-version: "1.23"

- name: Install ginkgo
run: |
make install-ginkgo

- name: Build images
env:
TAG: dev
Expand Down Expand Up @@ -111,4 +115,4 @@ jobs:
PROVIDER_TYPE: ${{ matrix.provider_type }}
TEST_LABEL: ${{ matrix.cases_subset }}
run: |
make e2e-test
make ginkgo-e2e-test
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ADC_VERSION ?= 0.20.0
GINKGO_VERSION ?= 2.20.0
TEST_TIMEOUT ?= 80m
TEST_DIR ?= ./test/e2e/apisix/
E2E_NODES ?= 2
E2E_NODES ?= 4

# CRD Reference Documentation
CRD_REF_DOCS_VERSION ?= v0.1.0
Expand Down Expand Up @@ -131,7 +131,7 @@ e2e-test:

.PHONY: ginkgo-e2e-test
ginkgo-e2e-test:
@ginkgo -cover -coverprofile=coverage.txt -r --randomize-all --randomize-suites --trace --focus=$(E2E_FOCUS) --nodes=$(E2E_NODES) $(TEST_DIR)
@ginkgo -cover -coverprofile=coverage.txt -r --randomize-all --randomize-suites --trace --focus=$(E2E_FOCUS) --nodes=$(E2E_NODES) --label-filter="$(TEST_LABEL)" $(TEST_DIR)

.PHONY: install-ginkgo
install-ginkgo:
Expand Down
69 changes: 50 additions & 19 deletions test/e2e/crds/v1alpha1/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,28 @@ package v1alpha1

import (
"fmt"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"

"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() {
s := scaffold.NewDefaultScaffold()
var (
s = scaffold.NewScaffold(&scaffold.Options{
ControllerName: fmt.Sprintf("apisix.apache.org/apisix-ingress-controller-%d", time.Now().Unix()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be used as the default behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revered to defaultscaffold

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted back to this behavior. I see a lot of tests fail when defaultScaffold is used. I am looking into the reason but for now I have reverted to this.

})
err error
)

var defaultGatewayProxy = `
apiVersion: apisix.apache.org/v1alpha1
kind: GatewayProxy
metadata:
name: apisix-proxy-config
name: %s
spec:
provider:
type: ControlPlane
Expand All @@ -59,7 +66,7 @@ spec:
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: apisix
name: %s
spec:
gatewayClassName: %s
listeners:
Expand All @@ -70,17 +77,18 @@ spec:
parametersRef:
group: apisix.apache.org
kind: GatewayProxy
name: apisix-proxy-config
name: %s
`

var defaultHTTPRoute = `
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httpbin
namespace: %s
spec:
parentRefs:
- name: apisix
- name: %s
hostnames:
- "httpbin.org"
rules:
Expand Down Expand Up @@ -125,7 +133,26 @@ spec:
`

BeforeEach(func() {
s.ApplyDefaultGatewayResource(defaultGatewayProxy, defaultGatewayClass, defaultGateway, defaultHTTPRoute)
gatewayName := s.Namespace()
By("create GatewayProxy")
gatewayProxyName := gatewayName
err = s.CreateResourceFromString(fmt.Sprintf(defaultGatewayProxy, gatewayProxyName, s.Deployer.GetAdminEndpoint(), s.AdminKey()))
Expect(err).NotTo(HaveOccurred(), "creating GatewayProxy")
time.Sleep(time.Second)

By("create GatewayClass")
gatewayClassName := fmt.Sprintf("apisix-%d", time.Now().Unix())
err = s.CreateResourceFromString(fmt.Sprintf(defaultGatewayClass, gatewayClassName, s.GetControllerName()))
Expect(err).NotTo(HaveOccurred(), "creating GatewayClass")
time.Sleep(time.Second)

By("create Gateway")
err = s.CreateResourceFromString(fmt.Sprintf(defaultGateway, gatewayName, gatewayClassName, gatewayProxyName))
Expect(err).NotTo(HaveOccurred(), "creating Gateway")
time.Sleep(time.Second)

By("create HTTPRoute")
s.ApplyHTTPRoute(types.NamespacedName{Namespace: s.Namespace(), Name: "httpbin"}, fmt.Sprintf(defaultHTTPRoute, gatewayName, s.Namespace()))
})
It("should rewrite upstream host", func() {
s.ResourceApplied("BackendTrafficPolicy", "httpbin", createUpstreamHost, 1)
Expand Down Expand Up @@ -184,15 +211,14 @@ spec:

var _ = Describe("Test BackendTrafficPolicy base on Ingress", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
ControllerName: fmt.Sprintf("apisix.apache.org/apisix-ingress-controller-%d", time.Now().Unix()),
})

var defaultGatewayProxy = `
apiVersion: apisix.apache.org/v1alpha1
kind: GatewayProxy
metadata:
name: apisix-proxy-config
namespace: default
name: %s
spec:
provider:
type: ControlPlane
Expand All @@ -212,12 +238,12 @@ metadata:
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
spec:
controller: "apisix.apache.org/apisix-ingress-controller"
controller: "%s"
parameters:
apiGroup: "apisix.apache.org"
kind: "GatewayProxy"
name: "apisix-proxy-config"
namespace: "default"
name: "%s"
namespace: "%s"
scope: "Namespace"
`

Expand All @@ -241,25 +267,28 @@ spec:
`
var beforeEach = func() {
By("create GatewayProxy")
gatewayProxy := fmt.Sprintf(defaultGatewayProxy, s.Deployer.GetAdminEndpoint(), s.AdminKey())
err := s.CreateResourceFromStringWithNamespace(gatewayProxy, "default")
gatewayProxyName := s.Namespace()
gatewayProxy := fmt.Sprintf(defaultGatewayProxy, gatewayProxyName, s.Deployer.GetAdminEndpoint(), s.AdminKey())
err := s.CreateResourceFromString(gatewayProxy)
Expect(err).NotTo(HaveOccurred(), "creating GatewayProxy")

By("create IngressClass with GatewayProxy reference")
err = s.CreateResourceFromStringWithNamespace(defaultIngressClass, "")
err = s.CreateResourceFromString(fmt.Sprintf(defaultIngressClass, s.GetControllerName(), gatewayProxyName, s.Namespace()))
Expect(err).NotTo(HaveOccurred(), "creating IngressClass with GatewayProxy")

By("create Ingress with GatewayProxy IngressClass")
err = s.CreateResourceFromString(defaultIngress)
Expect(err).NotTo(HaveOccurred(), "creating Ingress with GatewayProxy IngressClass")
}

Context("Rewrite Upstream Host", func() {
// Tests concerning the default ingress class need to be run serially
Context("Rewrite Upstream Host", Serial, func() {
var createUpstreamHost = `
apiVersion: apisix.apache.org/v1alpha1
kind: BackendTrafficPolicy
metadata:
name: httpbin
namespace: %s
spec:
targetRefs:
- name: httpbin-service-e2e-test
Expand All @@ -274,6 +303,7 @@ apiVersion: apisix.apache.org/v1alpha1
kind: BackendTrafficPolicy
metadata:
name: httpbin
namespace: %s
spec:
targetRefs:
- name: httpbin-service-e2e-test
Expand All @@ -293,19 +323,20 @@ spec:
"Host": "httpbin.org",
},
}
s.ResourceApplied("BackendTrafficPolicy", "httpbin", createUpstreamHost, 1)

s.ResourceApplied("BackendTrafficPolicy", "httpbin", fmt.Sprintf(createUpstreamHost, s.Namespace()), 1)
s.RequestAssert(reqAssert.SetChecks(
scaffold.WithExpectedStatus(200),
scaffold.WithExpectedBodyContains("httpbin.example.com"),
))

s.ResourceApplied("BackendTrafficPolicy", "httpbin", updateUpstreamHost, 2)
s.ResourceApplied("BackendTrafficPolicy", "httpbin", fmt.Sprintf(updateUpstreamHost, s.Namespace()), 2)
s.RequestAssert(reqAssert.SetChecks(
scaffold.WithExpectedStatus(200),
scaffold.WithExpectedBodyContains("httpbin.update.example.com"),
))

err := s.DeleteResourceFromString(createUpstreamHost)
err := s.DeleteResourceFromString(fmt.Sprintf(createUpstreamHost, s.Namespace()))
Expect(err).NotTo(HaveOccurred(), "deleting BackendTrafficPolicy")

s.RequestAssert(reqAssert.SetChecks(
Expand Down
Loading
Loading