@@ -536,7 +536,8 @@ async fn native_wasm_forbidden_header_mutation_fails_closed() {
536536
537537#[ tokio:: test]
538538async fn native_wasm_route_decision_selects_configured_canary_route ( ) {
539- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
539+ let fixture =
540+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
540541 let stable = upstream_expect_body ( "/lb/item" , "stable" ) . await ;
541542 let canary = upstream_expect_body ( "/lb/item" , "canary" ) . await ;
542543 let mut config = fixture. config_with_attachments (
@@ -567,7 +568,8 @@ async fn native_wasm_route_decision_selects_configured_canary_route() {
567568
568569#[ tokio:: test]
569570async fn native_wasm_route_decision_fails_closed_for_unconfigured_branch ( ) {
570- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
571+ let fixture =
572+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
571573 let stable = upstream_expect_body ( "/lb/item" , "stable" ) . await ;
572574 let mut config = fixture. config_with_attachments (
573575 stable,
@@ -594,7 +596,8 @@ async fn native_wasm_route_decision_fails_closed_for_unconfigured_branch() {
594596
595597#[ tokio:: test]
596598async fn native_wasm_route_decision_does_not_run_before_route_acl ( ) {
597- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
599+ let fixture =
600+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
598601 let upstream = super :: upstream_expect_path ( "/never" , "unexpected" ) . await ;
599602 let mut config = fixture. config_with_attachments (
600603 upstream,
@@ -624,7 +627,8 @@ async fn native_wasm_route_decision_does_not_run_before_route_acl() {
624627
625628#[ tokio:: test]
626629async fn native_wasm_route_decision_enforces_selected_route_rate_limit ( ) {
627- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
630+ let fixture =
631+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
628632 let stable = upstream_expect_body ( "/limit/item" , "stable" ) . await ;
629633 let canary = upstream_expect_body ( "/limit/item" , "canary" ) . await ;
630634 let mut config = fixture. config_with_attachments (
@@ -671,7 +675,8 @@ async fn native_wasm_route_decision_enforces_selected_route_rate_limit() {
671675#[ cfg( feature = "load-balancer" ) ]
672676#[ tokio:: test]
673677async fn native_wasm_route_decision_selects_configured_load_balanced_route ( ) {
674- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
678+ let fixture =
679+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
675680 let stable = upstream_expect_body ( "/lb/item" , "stable" ) . await ;
676681 let canary_a = upstream_expect_body ( "/lb/item" , "canary-a" ) . await ;
677682 let canary_b = upstream_expect_body ( "/lb/item" , "canary-b" ) . await ;
@@ -707,7 +712,8 @@ async fn native_wasm_route_decision_selects_configured_load_balanced_route() {
707712#[ cfg( feature = "load-balancer" ) ]
708713#[ tokio:: test]
709714async fn native_wasm_route_decision_selects_configured_persistent_route ( ) {
710- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
715+ let fixture =
716+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
711717 let stable = upstream_expect_body ( "/sticky/item" , "stable" ) . await ;
712718 let sticky_a = upstream_body_loop ( "sticky-a" , 2 ) . await ;
713719 let sticky_b = upstream_body_loop ( "sticky-b" , 2 ) . await ;
@@ -757,7 +763,8 @@ async fn native_wasm_route_decision_selects_configured_persistent_route() {
757763#[ cfg( all( feature = "traffic-mirror" , not( feature = "privacy-mode" ) ) ) ]
758764#[ tokio:: test]
759765async fn native_wasm_route_decision_selects_configured_mirror_route ( ) {
760- let fixture = WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: RouteDecision ) ] ) ;
766+ let fixture =
767+ WasmRouteFixture :: new ( & [ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ] ) ;
761768 let origin = upstream_expect_body ( "/shadow/item" , "origin" ) . await ;
762769 let ( mirror, mirror_rx) = mirror_endpoint ( ) . await ;
763770 let mut config = fixture. config_with_attachments (
@@ -1169,7 +1176,7 @@ async fn native_wasm_cross_family_chain_runs_in_order_with_cache_hit_metadata()
11691176 let fixture = WasmRouteFixture :: new ( & [
11701177 ( "access" , WasmPluginBody :: Decision ( 1 ) ) ,
11711178 ( "headers" , WasmPluginBody :: OpenRestyHeaderPolicyExample ) ,
1172- ( "router" , WasmPluginBody :: RouteDecision ) ,
1179+ ( "router" , WasmPluginBody :: HaProxySpoeRoutingPolicyExample ) ,
11731180 ( "cache_key" , WasmPluginBody :: CacheLookupDeviceKey ) ,
11741181 ( "cache_store" , WasmPluginBody :: CacheStoreHeader ) ,
11751182 ] ) ;
@@ -1904,7 +1911,7 @@ enum WasmPluginBody {
19041911 IrulesAccessPolicyExample ,
19051912 OpenRestyHeaderPolicyExample ,
19061913 ForbiddenHeader ,
1907- RouteDecision ,
1914+ HaProxySpoeRoutingPolicyExample ,
19081915 CacheLookup ,
19091916 CacheLookupDeviceKey ,
19101917 CacheLookupForbiddenKey ,
@@ -1960,32 +1967,9 @@ impl WasmPluginBody {
19601967 "#
19611968 . to_owned ( )
19621969 }
1963- Self :: RouteDecision => {
1964- r#"
1965- (module
1966- (import "fluxheim_policy_v1" "context" (func $context (param i32 i32) (result i32)))
1967- (func (export "fluxheim_route_decision") (result i32)
1968- i32.const 3
1969- i32.const 0
1970- call $context
1971- i32.const 1
1972- i32.eq
1973- if (result i32)
1974- i32.const 3
1975- else
1976- i32.const 2
1977- i32.const 0
1978- call $context
1979- i32.const 1
1980- i32.eq
1981- if (result i32)
1982- i32.const 1
1983- else
1984- i32.const 0
1985- end
1986- end))
1987- "#
1988- . to_owned ( )
1970+ Self :: HaProxySpoeRoutingPolicyExample => {
1971+ include_str ! ( "../../../../examples/wasm/haproxy-spoe-routing-policy.wat" )
1972+ . to_owned ( )
19891973 }
19901974 Self :: CacheLookup => {
19911975 r#"
@@ -2332,7 +2316,9 @@ fn wasm_plugin_phases(body: WasmPluginBody) -> Vec<fluxheim_config::WasmPluginPh
23322316 WasmPluginBody :: ForbiddenHeader => {
23332317 vec ! [ fluxheim_config:: WasmPluginPhase :: RequestHeaders ]
23342318 }
2335- WasmPluginBody :: RouteDecision => vec ! [ fluxheim_config:: WasmPluginPhase :: RouteDecision ] ,
2319+ WasmPluginBody :: HaProxySpoeRoutingPolicyExample => {
2320+ vec ! [ fluxheim_config:: WasmPluginPhase :: RouteDecision ]
2321+ }
23362322 WasmPluginBody :: CacheLookup
23372323 | WasmPluginBody :: CacheLookupDeviceKey
23382324 | WasmPluginBody :: CacheLookupForbiddenKey
0 commit comments