Skip to content

Commit bc5f724

Browse files
author
Yehudit Kerido
committed
[E2E] Add Signal-Decision Engine Test Coverage for New Plugin Architecture
Signed-off-by: Yehudit Kerido <[email protected]>
1 parent ee6e87e commit bc5f724

File tree

12 files changed

+1880
-6
lines changed

12 files changed

+1880
-6
lines changed

deploy/kubernetes/aibrix/semantic-router-values/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ config:
367367
conditions:
368368
- type: "domain"
369369
name: "thinking"
370+
- type: "keyword"
371+
name: "thinking"
370372
modelRefs:
371373
- model: vllm-llama3-8b-instruct
372374
use_reasoning: true
@@ -445,7 +447,7 @@ config:
445447
pii_mapping_path: "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json"
446448

447449
keyword_rules:
448-
- category: "thinking"
450+
- name: "thinking"
449451
operator: "OR"
450452
keywords: ["urgent", "immediate", "asap", "think", "careful"]
451453
case_sensitive: false

e2e/README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ e2e/
3939
│ ├── domain_classify.go
4040
│ ├── cache.go
4141
│ ├── pii_detection.go
42-
│ └── jailbreak_detection.go
42+
│ ├── jailbreak_detection.go
43+
│ ├── decision_priority.go # Signal-decision: Priority selection
44+
│ ├── plugin_chain_execution.go # Signal-decision: Plugin chains
45+
│ ├── rule_condition_logic.go # Signal-decision: AND/OR operators
46+
│ ├── decision_fallback.go # Signal-decision: Fallback behavior
47+
│ ├── keyword_routing.go # Signal-decision: Keyword matching
48+
│ └── plugin_config_variations.go # Signal-decision: Plugin configs
4349
├── profiles/
4450
│ └── ai-gateway/ # AI Gateway test profile
4551
│ └── profile.go # Profile definition and environment setup
@@ -50,19 +56,47 @@ e2e/
5056

5157
The framework includes the following test cases (all in `e2e/testcases/`):
5258

59+
### Basic Functionality Tests
60+
5361
| Test Case | Description | Metrics |
5462
|-----------|-------------|---------|
5563
| `chat-completions-request` | Basic chat completions API test | Response validation |
5664
| `chat-completions-stress-request` | Sequential stress test with 1000 requests | Success rate, avg duration |
5765
| `chat-completions-progressive-stress` | Progressive QPS stress test (10/20/50/100 QPS) | Per-stage success rate, latency stats |
66+
67+
### Classification and Feature Tests
68+
69+
| Test Case | Description | Metrics |
70+
|-----------|-------------|---------|
5871
| `domain-classify` | Domain classification accuracy | 65 cases, accuracy rate |
5972
| `semantic-cache` | Semantic cache hit rate | 5 groups, cache hit rate |
6073
| `pii-detection` | PII detection and blocking | 10 PII types, detection rate, block rate |
6174
| `jailbreak-detection` | Jailbreak attack detection | 10 attack types, detection rate, block rate |
6275

76+
### Signal-Decision Engine Tests
77+
78+
| Test Case | Description | Metrics |
79+
|-----------|-------------|---------|
80+
| `decision-priority-selection` | Decision priority selection with multiple matches | 4 cases, priority validation |
81+
| `plugin-chain-execution` | Plugin execution order (PII → Cache → System Prompt) | 4 cases, chain validation, blocking behavior |
82+
| `rule-condition-logic` | AND/OR operators and keyword matching | 6 cases, operator validation |
83+
| `decision-fallback-behavior` | Fallback to default decision when no match | 5 cases, fallback validation |
84+
| `keyword-routing` | Keyword-based routing decisions | 6 cases, keyword matching (case-insensitive) |
85+
| `plugin-config-variations` | Plugin configuration variations (PII allowlist, cache thresholds) | 6 cases, config validation |
86+
87+
**Signal-Decision Engine Features Tested:**
88+
- ✅ Decision priority selection (priority 15 > 10)
89+
- ✅ Plugin chain execution order and blocking
90+
- ✅ Rule condition logic (AND/OR operators)
91+
- ✅ Keyword-based routing (case-insensitive)
92+
- ✅ Decision fallback behavior
93+
- ✅ Per-decision plugin configurations
94+
- ✅ PII allowlist handling
95+
- ✅ Per-decision cache thresholds (0.75, 0.92, 0.95)
96+
6397
All test cases:
6498

65-
- Use model name `"MoM"`
99+
- Use model name `"MoM"` to trigger decision engine
66100
- Automatically clean up port forwarding
67101
- Generate detailed reports with statistics
68102
- Support verbose logging
@@ -312,6 +346,14 @@ Test data is stored in `e2e/testcases/testdata/` as JSON files. Each test case l
312346
- `pii_detection_cases.json`: 10 PII types (email, phone, SSN, etc.)
313347
- `jailbreak_detection_cases.json`: 10 attack types (prompt injection, DAN, etc.)
314348

349+
**Signal-Decision Engine Tests** use embedded test cases (defined inline in test files) to validate:
350+
- Decision priority mechanisms (4 test cases)
351+
- Plugin chain execution and blocking (4 test cases)
352+
- Rule condition logic with AND/OR operators (6 test cases)
353+
- Decision fallback behavior (5 test cases)
354+
- Keyword-based routing (6 test cases)
355+
- Plugin configuration variations (6 test cases)
356+
315357
**Test Data Format Example:**
316358

317359
```json

e2e/profiles/ai-gateway/profile.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,27 @@ func (p *Profile) Teardown(ctx context.Context, opts *framework.TeardownOptions)
107107
// GetTestCases returns the list of test cases for this profile
108108
func (p *Profile) GetTestCases() []string {
109109
return []string{
110+
// Basic functionality tests
110111
"chat-completions-request",
111112
"chat-completions-stress-request",
113+
114+
// Classification and routing tests
112115
"domain-classify",
116+
117+
// Feature tests
113118
"semantic-cache",
114119
"pii-detection",
115120
"jailbreak-detection",
121+
122+
// Signal-Decision engine tests (new architecture)
123+
"decision-priority-selection", // Priority-based routing
124+
"plugin-chain-execution", // Plugin ordering and blocking
125+
"rule-condition-logic", // AND/OR operators
126+
"decision-fallback-behavior", // Fallback to default
127+
"keyword-routing", // Keyword-based decisions
128+
"plugin-config-variations", // Plugin configuration testing
129+
130+
// Load tests
116131
"chat-completions-progressive-stress",
117132
}
118133
}

e2e/profiles/ai-gateway/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ config:
367367
operator: "OR"
368368
conditions:
369369
- type: "keyword"
370-
rule_name: "thinking"
370+
name: "thinking"
371371
modelRefs:
372372
- model: base-model
373373
lora_name: general-expert
@@ -383,7 +383,7 @@ config:
383383
system_prompt: "You are a thinking expert, should think multiple steps before answering. Please answer the question step by step."
384384
mode: "replace"
385385

386-
- name: general_decision
386+
- name: other_decision
387387
description: "General knowledge and miscellaneous topics"
388388
priority: 1
389389
rules:
@@ -474,7 +474,7 @@ config:
474474
pii_mapping_path: "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json"
475475

476476
keyword_rules:
477-
- category: "thinking"
477+
- name: "thinking"
478478
operator: "OR"
479479
keywords: ["urgent", "immediate", "asap", "think", "careful"]
480480
case_sensitive: false

e2e/profiles/aibrix/profile.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,27 @@ func (p *Profile) Teardown(ctx context.Context, opts *framework.TeardownOptions)
167167
// GetTestCases returns the list of test cases for this profile
168168
func (p *Profile) GetTestCases() []string {
169169
return []string{
170+
// Basic functionality tests
170171
"chat-completions-request",
171172
"chat-completions-stress-request",
173+
174+
// Classification and routing tests
172175
"domain-classify",
176+
177+
// Feature tests
173178
"semantic-cache",
174179
"pii-detection",
175180
"jailbreak-detection",
181+
182+
// Signal-Decision engine tests (new architecture)
183+
"decision-priority-selection", // Priority-based routing
184+
"plugin-chain-execution", // Plugin ordering and blocking
185+
"rule-condition-logic", // AND/OR operators
186+
"decision-fallback-behavior", // Fallback to default
187+
"keyword-routing", // Keyword-based decisions
188+
"plugin-config-variations", // Plugin configuration testing
189+
190+
// Load tests
176191
"chat-completions-progressive-stress",
177192
}
178193
}

0 commit comments

Comments
 (0)