This is an automated email from the ASF dual-hosted git repository.

young pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new a49ccd086 fix: global rules tests (#3285)
a49ccd086 is described below

commit a49ccd086cf91adb63e2cd663ade26981cb65e42
Author: YYYoung <[email protected]>
AuthorDate: Tue Jan 13 14:30:17 2026 +0800

    fix: global rules tests (#3285)
---
 e2e/tests/global_rules.list.spec.ts | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/e2e/tests/global_rules.list.spec.ts 
b/e2e/tests/global_rules.list.spec.ts
index bef295f88..ff770537e 100644
--- a/e2e/tests/global_rules.list.spec.ts
+++ b/e2e/tests/global_rules.list.spec.ts
@@ -58,19 +58,30 @@ interface GlobalRule {
   plugins: Record<string, unknown>;
 }
 
+// APISIX allows only one global rule per plugin type
+// So we need to use different plugins for each rule
+const pluginConfigs = [
+  { 'response-rewrite': { headers: { set: { 'X-Test': '1' } } } },
+  { cors: { allow_origins: '*' } },
+  { 'ip-restriction': { whitelist: ['127.0.0.1'] } },
+  { 'referer-restriction': { whitelist: ['*.example.com'] } },
+  { 'uri-blocker': { block_rules: ['^/blocked'] } },
+  { 'request-id': { include_in_response: true } },
+  { 'proxy-rewrite': { uri: '/test' } },
+  { echo: { body: 'test' } },
+  { gzip: { min_length: 1 } },
+  { 'real-ip': { source: 'http_x_forwarded_for' } },
+  { 'client-control': { max_body_size: 1024 } },
+];
+
 const globalRules: GlobalRule[] = Array.from({ length: 11 }, (_, i) => ({
   id: `global_rule_id_${i + 1}`,
-  plugins: {
-    'response-rewrite': {
-      headers: {
-        'X-Test-Rule': `global-rule-${i + 1}`,
-      },
-    },
-  },
+  plugins: pluginConfigs[i],
 }));
 
 test.describe('page and page_size should work correctly', () => {
   test.describe.configure({ mode: 'serial' });
+
   test.beforeAll(async () => {
     await deleteAllGlobalRules(e2eReq);
     await Promise.all(

Reply via email to