test(e2e): consolidate selector tests, add round-robin/fifo/backup failover

Merge parallel_selector_test.go into selector_test.go and add e2e coverage
for the round-robin + fail filter, fifo sticky fallback, and backup filter
strategies. Each test drives requests through a hop with one dead node and
asserts the selector marks and skips it so traffic converges on the live node.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ginuerzh
2026-07-16 20:53:30 +08:00
co-authored by Claude
parent 94dcc9c045
commit a8bd4a5f16
7 changed files with 220 additions and 58 deletions
+37
View File
@@ -0,0 +1,37 @@
services:
- name: proxy
addr: :8080
handler:
type: http
chain: my-chain
listener:
type: tcp
# Live relay: forwards the request to the echo server (curl target).
- name: relay
addr: 127.0.0.1:18081
handler:
type: http
listener:
type: tcp
chains:
- name: my-chain
hops:
- name: hop-1
selector:
strategy: round
maxFails: 1
nodes:
# primary: dead, non-backup.
- name: node-1
addr: 127.0.0.1:18082
connector:
type: http
# backup: only used once all primary nodes are dead.
- name: node-2
addr: 127.0.0.1:18081
connector:
type: http
metadata:
backup: true
+34
View File
@@ -0,0 +1,34 @@
services:
- name: proxy
addr: :8080
handler:
type: http
chain: my-chain
listener:
type: tcp
# Live relay: forwards the request to the echo server (curl target).
- name: relay
addr: 127.0.0.1:18081
handler:
type: http
listener:
type: tcp
chains:
- name: my-chain
hops:
- name: hop-1
selector:
strategy: fifo
maxFails: 1
nodes:
# primary: dead, so fifo must fall through to the secondary node.
- name: node-1
addr: 127.0.0.1:18082
connector:
type: http
- name: node-2
addr: 127.0.0.1:18081
connector:
type: http
+34
View File
@@ -0,0 +1,34 @@
services:
- name: proxy
addr: :8080
handler:
type: http
chain: my-chain
listener:
type: tcp
# Live relay: forwards the request to the echo server (curl target).
- name: relay
addr: 127.0.0.1:18081
handler:
type: http
listener:
type: tcp
chains:
- name: my-chain
hops:
- name: hop-1
selector:
strategy: round
maxFails: 1
nodes:
- name: node-1
addr: 127.0.0.1:18081
connector:
type: http
# dead node: never listens; must be marked and skipped by the selector.
- name: node-2
addr: 127.0.0.1:18082
connector:
type: http