Skip to content

Commit 68e56be

Browse files
committed
feat: add E2E test case labeling and enhance test framework
- Introduced Ginkgo labels for categorizing E2E test cases based on apisix resource type and networking components. - Updated Makefile and GitHub Actions workflow to include label-based test execution. - Improved ADC output handling and extended backend mode validation logic.
1 parent c1f257d commit 68e56be

File tree

20 files changed

+37
-18
lines changed

20 files changed

+37
-18
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
provider_type:
4141
- apisix-standalone
4242
- apisix
43+
cases_subset:
44+
- apisix
45+
- networking
4346
runs-on: buildjet-2vcpu-ubuntu-2204
4447
steps:
4548
- name: Checkout
@@ -89,5 +92,6 @@ jobs:
8992
env:
9093
TEST_DIR: "./test/e2e/apisix/"
9194
PROVIDER_TYPE: ${{ matrix.provider_type }}
95+
TEST_LABEL: ${{ matrix.cases_subset }}
9296
run: |
9397
make e2e-test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ kind-e2e-test: kind-up build-image kind-load-images e2e-test
111111
.PHONY: e2e-test
112112
e2e-test:
113113
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
114-
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
114+
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)" -ginkgo.label-filter="$(TEST_LABEL)"
115115

116116
.PHONY: download-api7ee3-chart
117117
download-api7ee3-chart:

internal/provider/adc/adc.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,18 @@ func (d *adcClient) Update(ctx context.Context, tctx *provider.TranslateContext,
189189
// This mode is full synchronization,
190190
// which only needs to be saved in cache
191191
// and triggered by a timer for synchronization
192-
if d.BackendMode == BackendModeAPISIXStandalone || d.BackendMode == BackendModeAPISIX || apiv2.Is(obj) {
192+
switch d.BackendMode {
193+
case BackendModeAPI7EE:
194+
if apiv2.Is(obj) {
195+
return nil
196+
}
197+
case BackendModeAPISIX:
198+
// do nothing
199+
case BackendModeAPISIXStandalone:
193200
return nil
201+
default:
202+
return errors.Errorf("unknown backend mode: %s", d.BackendMode)
203+
194204
}
195205

196206
return d.sync(ctx, Task{

internal/provider/adc/executor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ func (e *DefaultADCExecutor) buildCmdError(runErr error, stdout, stderr []byte)
112112

113113
func (e *DefaultADCExecutor) handleOutput(output []byte) error {
114114
var result adctypes.SyncResult
115+
if index := strings.IndexByte(string(output), '{'); index > 0 {
116+
log.Warnf("extra output: %s", string(output[:index]))
117+
output = output[index:]
118+
}
115119
if err := json.Unmarshal(output, &result); err != nil {
116120
log.Errorw("failed to unmarshal adc output",
117121
zap.Error(err),

test/e2e/apisix/basic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2020
)
2121

22-
var _ = Describe("APISIX Standalone Basic Tests", func() {
22+
var _ = Describe("APISIX Standalone Basic Tests", Label("apisix", "v2", "basic"), func() {
2323
s := scaffold.NewScaffold(&scaffold.Options{
2424
ControllerName: "apisix.apache.org/apisix-ingress-controller",
2525
})

test/e2e/apisix/consumer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
type Headers map[string]string
3030

31-
var _ = Describe("Test ApisixConsumer", func() {
31+
var _ = Describe("Test ApisixConsumer", Label("apisix", "v2", "apisixconsumer"), func() {
3232
var (
3333
s = scaffold.NewScaffold(&scaffold.Options{
3434
ControllerName: "apisix.apache.org/apisix-ingress-controller",

test/e2e/apisix/globalrule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
scope: "Namespace"
5757
`
5858

59-
var _ = Describe("Test GlobalRule", func() {
59+
var _ = Describe("Test GlobalRule", Label("apisix", "v2", "apisixglobalrule"), func() {
6060
s := scaffold.NewScaffold(&scaffold.Options{
6161
ControllerName: "apisix.apache.org/apisix-ingress-controller",
6262
})

test/e2e/apisix/pluginconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ spec:
5959
scope: "Namespace"
6060
`
6161

62-
var _ = Describe("Test ApisixPluginConfig", func() {
62+
var _ = Describe("Test ApisixPluginConfig", Label("apisix", "v2", "apisixpluginconfig"), func() {
6363
var (
6464
s = scaffold.NewScaffold(&scaffold.Options{
6565
ControllerName: "apisix.apache.org/apisix-ingress-controller",

test/e2e/apisix/route.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2828
)
2929

30-
var _ = Describe("Test ApisixRoute", func() {
30+
var _ = Describe("Test ApisixRoute", Label("apisix", "v2", "apisixroute"), func() {
3131
var (
3232
s = scaffold.NewScaffold(&scaffold.Options{
3333
ControllerName: "apisix.apache.org/apisix-ingress-controller",

test/e2e/apisix/tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var Cert = strings.TrimSpace(framework.TestServerCert)
8585

8686
var Key = strings.TrimSpace(framework.TestServerKey)
8787

88-
var _ = Describe("Test ApisixTls", func() {
88+
var _ = Describe("Test ApisixTls", Label("apisix", "v2", "apisixtls"), func() {
8989
var (
9090
s = scaffold.NewScaffold(&scaffold.Options{
9191
ControllerName: "apisix.apache.org/apisix-ingress-controller",

0 commit comments

Comments
 (0)