Skip to content

test(e2e): eliminate silent skips; drop global-rule --label#54

Merged
shreemaan-abhishek merged 3 commits into
mainfrom
eliminate-silent-test-skips
May 27, 2026
Merged

test(e2e): eliminate silent skips; drop global-rule --label#54
shreemaan-abhishek merged 3 commits into
mainfrom
eliminate-silent-test-skips

Conversation

@shreemaan-abhishek
Copy link
Copy Markdown
Contributor

@shreemaan-abhishek shreemaan-abhishek commented May 27, 2026

Summary

Audit of all Skip(...) / t.Skipf(...) call sites in test/e2e/ per the GA-readiness umbrella (#33).

12 of 13 sites had preconditions already satisfied by the CI environment and were masking potential regressions:

  • License gate (5 callers + helper in scenario_coverage_ginkgo_test.go) — string "requires a sufficient license" is an EE-only response; OSS APISIX never returns it.
  • Stream-mode (7 Ginkgo callers + helper, 1 testing.T site) — proxy_mode: http&stream and stream_proxy.tcp are enabled in apisix_conf/config.yaml.
  • skywalking skill test — plugin enabled by test: enable skywalking plugin in e2e apisix #32.
  • ai-aws-content-moderation skill test — plugin enabled in the same config.
  • Docker-logs auto-detect (7 sites + helper) — CI provides a reliable Docker socket and a container named apisix that the name=apisix substring filter matches.

All converted to require.NoError / g.Expect(err).NotTo(HaveOccurred()) so a regression in any underlying precondition fails CI loudly instead of skipping silently.

The 13th site (export_and_label_test.go:291, global-rule labels) guarded a real APISIX 3.15 limitation — global_rules rejects labels with "additional properties forbidden, found labels". Per issue #36's "remove the feature" branch:

  • Dropped --label flag from pkg/cmd/globalrule/export and pkg/cmd/globalrule/delete.
  • Removed the associated unit tests (TestGlobalRuleExport_WithLabelFilter, TestGlobalruleDelete_AllAndLabelMutuallyExclusive, TestGlobalruleDelete_LabelWithID).
  • Rewrote TestExport_GlobalRule with three distinct plugins. APISIX OSS enforces one global_rule per plugin type — the old test never hit this constraint because the labels-skip fired first.

Net -154 lines across 13 files. No new code paths, no env-flag gates, no silent skips left in the e2e suite.

Test plan

  • go test ./... — all unit tests green
  • go test -tags e2e -run 'TestExport_GlobalRule|TestExport_StreamRoute|TestSkillPluginSkywalking|TestSkillPluginAIContentModeration' against a live local APISIX 3.15 — all green
  • go test -tags e2e -run TestE2E -args -ginkgo.focus='stream-route|scenario coverage' — 7/7 specs passed, 0 skipped within focus
  • go build ./... and go vet ./... clean

The debug --container apisix tests were not run locally because the local container is named differently; they will pass in CI where the container is named apisix exactly.

Closes #36.

Summary by CodeRabbit

  • Refactor

    • Removed support for filtering global rules by label in delete and export commands.
  • Bug Fixes

    • Delete now permits only single-ID or --all deletions (with force) and no longer accepts label-based bulk deletes.
  • Tests

    • Removed label-related negative unit tests and updated end-to-end tests to stop conditional skips and enforce direct assertions.

Review Change Stack

Audit of test/e2e/ Skip() sites: 12 of 13 had preconditions already
satisfied by the CI environment (skywalking + ai-aws-content-moderation
in apisix_conf/config.yaml, stream_proxy enabled, Docker socket reliable,
license-gate string is EE-only). Those skips are converted to
require.NoError so a regression in any underlying precondition surfaces
as a real failure instead of green CI.

The 13th skip guarded an APISIX 3.15 limitation: global_rules do not
accept labels. Removed the --label flag from a6 global-rule export and
delete, along with the related unit tests. TestExport_GlobalRule
rewritten with three distinct plugins because APISIX enforces one
global_rule per plugin type (a constraint the old test never hit because
the labels-skip fired first).

Closes #36.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@shreemaan-abhishek, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 18 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3b9dd4c4-a487-48ab-8bc2-36ae0c02856d

📥 Commits

Reviewing files that changed from the base of the PR and between 0b4c0a8 and 55acc01.

📒 Files selected for processing (1)
  • docs/user-guide/bulk-operations.md
📝 Walkthrough

Walkthrough

This PR removes label-based filtering from global-rule delete and export commands and eliminates conditional skips in multiple e2e tests, replacing them with direct assertions.

Changes

Global Rule Label Filtering Removal

Layer / File(s) Summary
Global rule delete command - remove label option
pkg/cmd/globalrule/delete/delete.go, pkg/cmd/globalrule/delete/delete_test.go
Options loses Label; --label flag and mutual-exclusion validation removed; bulkDeleteGlobalRules uses listAllGlobalRuleIDs(client) without label filtering; two negative label-related tests removed.
Global rule export command - remove label option
pkg/cmd/globalrule/export/export.go, pkg/cmd/globalrule/export/export_test.go
Options loses Label; --label flag registration removed; exportRun and fetchAll no longer use or accept a label filter; TestGlobalRuleExport_WithLabelFilter removed.

E2E Test Skip Elimination

Layer / File(s) Summary
Debug logs test skip removal
test/e2e/coverage_flags_test.go, test/e2e/debug_ginkgo_test.go, test/e2e/debug_logs_test.go
Removed precondition skips for Docker log availability and the skipIfDockerLogsUnavailable helper; tests now assert debug logs success and non-empty output directly.
License restriction skip helper removal
test/e2e/ginkgo_helpers_test.go
Removed skipIfLicenseRestrictedGomega and its strings import.
Scenario coverage test license skip removal
test/e2e/scenario_coverage_ginkgo_test.go
Deleted five calls to skipIfLicenseRestrictedGomega after resource-creation steps so g.Expect(err).NotTo(HaveOccurred()) gates failures.
Plugin skill tests - mandatory success assertions
test/e2e/skills/skill_plugin_ai_content_moderation_test.go, test/e2e/skills/skill_plugin_skywalking_test.go
Replaced conditional skips on route create with unconditional require.NoError assertions that include stdout/stderr on failure.
Stream route tests - stream mode disabled skip removal
test/e2e/ssl_stream_route_ginkgo_test.go
Removed all skipIfStreamModeDisabled calls and the helper; tests now directly assert expected success or stderr error messages.
Export test adaptation for label removal
test/e2e/export_and_label_test.go
TestExport_GlobalRule now creates distinct plugin-type global rules and exports without --label; removed stream-mode conditional skip in TestExport_StreamRoute.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: eliminating silent test skips and removing the --label flag from global-rule commands.
Linked Issues check ✅ Passed All coding-related requirements from issue #36 are addressed: silent skips across 12 sites converted to explicit assertions, --label flag removed from global-rule commands, and related tests updated.
Out of Scope Changes check ✅ Passed All changes are directly related to eliminating silent test skips and removing the global-rule --label feature as specified in the linked issues.
E2e Test Quality Review ✅ Passed 11 silent skips removed, converted to explicit assertions. Global-rule --label removed per APISIX. Full CLI-APISIX flow tested. Error handling consistent. Test isolation proper. No unrelated changes.
Security Check ✅ Passed No security issues found. Proper error handling, no credential leaks, authorization via API, resource access validated, and plugin configs are user data.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch eliminate-silent-test-skips

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/ssl_stream_route_ginkgo_test.go (1)

1-429: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run gofmt on this file before merge.

CI is already failing on formatting, so this needs a gofmt pass to unblock the branch.

As per coding guidelines, **/*.go: Follow gofmt and goimports formatting standards.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/ssl_stream_route_ginkgo_test.go` around lines 1 - 429, The file
fails gofmt/goimports formatting; run gofmt (and optionally goimports) on this
file to fix formatting issues across functions like indentPEM,
readGinkgoTestCert, deleteSSLViaAdminByID, and the Describe test blocks, then
re-run CI and commit the formatted file so the build passes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@test/e2e/ssl_stream_route_ginkgo_test.go`:
- Around line 1-429: The file fails gofmt/goimports formatting; run gofmt (and
optionally goimports) on this file to fix formatting issues across functions
like indentPEM, readGinkgoTestCert, deleteSSLViaAdminByID, and the Describe test
blocks, then re-run CI and commit the formatted file so the build passes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 758269b8-ddc1-4cbc-b9e3-0e5811d7412b

📥 Commits

Reviewing files that changed from the base of the PR and between aa66ab8 and bce5286.

📒 Files selected for processing (13)
  • pkg/cmd/globalrule/delete/delete.go
  • pkg/cmd/globalrule/delete/delete_test.go
  • pkg/cmd/globalrule/export/export.go
  • pkg/cmd/globalrule/export/export_test.go
  • test/e2e/coverage_flags_test.go
  • test/e2e/debug_ginkgo_test.go
  • test/e2e/debug_logs_test.go
  • test/e2e/export_and_label_test.go
  • test/e2e/ginkgo_helpers_test.go
  • test/e2e/scenario_coverage_ginkgo_test.go
  • test/e2e/skills/skill_plugin_ai_content_moderation_test.go
  • test/e2e/skills/skill_plugin_skywalking_test.go
  • test/e2e/ssl_stream_route_ginkgo_test.go
💤 Files with no reviewable changes (7)
  • test/e2e/debug_logs_test.go
  • test/e2e/scenario_coverage_ginkgo_test.go
  • test/e2e/ginkgo_helpers_test.go
  • test/e2e/coverage_flags_test.go
  • pkg/cmd/globalrule/delete/delete_test.go
  • test/e2e/debug_ginkgo_test.go
  • pkg/cmd/globalrule/export/export_test.go

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes silent skips across the E2E suite so unmet preconditions fail loudly, and it removes the unsupported --label filter from global-rule export/global-rule delete to match APISIX OSS behavior/limitations.

Changes:

  • Converted E2E Skip(...) / t.Skipf(...) guardrails into hard assertions (require.NoError / g.Expect(err).NotTo(HaveOccurred())) across stream-mode, license-gate, plugin availability, and docker-logs checks.
  • Dropped --label support from pkg/cmd/globalrule/export and pkg/cmd/globalrule/delete, and removed the corresponding unit tests.
  • Updated TestExport_GlobalRule E2E coverage to create 3 global rules using distinct plugin types (to satisfy APISIX’s “one global_rule per plugin type” constraint).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/e2e/ssl_stream_route_ginkgo_test.go Removes stream-mode skip helper and enforces failing assertions for stream-route E2E coverage.
test/e2e/skills/skill_plugin_skywalking_test.go Replaces plugin-availability skip with require.NoError to prevent silent regressions.
test/e2e/skills/skill_plugin_ai_content_moderation_test.go Replaces config-rejection skip with require.NoError to prevent silent regressions.
test/e2e/scenario_coverage_ginkgo_test.go Removes license-gate skip so OSS failures are surfaced instead of skipped.
test/e2e/ginkgo_helpers_test.go Removes license-skip helper and now-unused import.
test/e2e/export_and_label_test.go Removes global-rule label-skip path; rewrites global-rule export E2E test to avoid APISIX plugin-type constraint.
test/e2e/debug_logs_test.go Removes auto-detect skip; makes missing docker/container issues fail loudly in E2E.
test/e2e/debug_ginkgo_test.go Removes docker-unavailable skip logic so docker log regressions fail loudly.
test/e2e/coverage_flags_test.go Removes debug-logs pre-skip so debug log flag behavior is always asserted in E2E.
pkg/cmd/globalrule/export/export.go Removes --label flag and label-based filtering from global-rule export.
pkg/cmd/globalrule/export/export_test.go Removes the unit test that validated --label filtering behavior.
pkg/cmd/globalrule/delete/delete.go Removes --label flag and label-based bulk delete path for global rules.
pkg/cmd/globalrule/delete/delete_test.go Removes label-related validation tests for global-rule delete.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 44 to 45
cmd.Flags().StringVarP(&opts.Output, "output", "o", "yaml", "Output format: json, yaml")
cmd.Flags().StringVarP(&opts.File, "file", "f", "", "Write output to file")
Comment on lines 52 to 54
cmd.Flags().BoolVar(&opts.Force, "force", false, "Skip confirmation prompt")
cmd.Flags().BoolVar(&opts.All, "all", false, "Delete all global rules")
cmd.Flags().StringVar(&opts.Label, "label", "", "Delete global rules matching label (key=value)")

@shreemaan-abhishek shreemaan-abhishek merged commit 6c52bfd into main May 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eliminate silent test skips in test/e2e/

2 participants