From 008562a997a6176b03fcf4cd662fa46681ca8eba Mon Sep 17 00:00:00 2001 From: Megrez Lu Date: Thu, 11 Jul 2024 10:05:06 +0800 Subject: [PATCH] fix testcase Signed-off-by: Megrez Lu --- .../traffic_routing_with_matches.yaml | 4 ++++ .../custom_network_provider_test.go | 22 ++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lua_configuration/networking.istio.io/VirtualService/testdata/traffic_routing_with_matches.yaml b/lua_configuration/networking.istio.io/VirtualService/testdata/traffic_routing_with_matches.yaml index eb5c4ed7..9c6dc55d 100644 --- a/lua_configuration/networking.istio.io/VirtualService/testdata/traffic_routing_with_matches.yaml +++ b/lua_configuration/networking.istio.io/VirtualService/testdata/traffic_routing_with_matches.yaml @@ -66,6 +66,10 @@ expected: - headers: user-agent: exact: pc + headers: + request: + set: + header-foo: bar route: - destination: host: svc-demo diff --git a/pkg/trafficrouting/network/customNetworkProvider/custom_network_provider_test.go b/pkg/trafficrouting/network/customNetworkProvider/custom_network_provider_test.go index 08eb22c4..82fc0f1a 100644 --- a/pkg/trafficrouting/network/customNetworkProvider/custom_network_provider_test.go +++ b/pkg/trafficrouting/network/customNetworkProvider/custom_network_provider_test.go @@ -710,11 +710,12 @@ func TestLuaScript(t *testing.T) { Annotations: testCase.Original.GetAnnotations(), Spec: testCase.Original.Object["spec"], }, - Matches: step.TrafficRoutingStrategy.Matches, - CanaryWeight: *weight, - StableWeight: 100 - *weight, - CanaryService: canaryService, - StableService: stableService, + Matches: step.TrafficRoutingStrategy.Matches, + CanaryWeight: *weight, + StableWeight: 100 - *weight, + CanaryService: canaryService, + StableService: stableService, + RequestHeaderModifier: step.TrafficRoutingStrategy.RequestHeaderModifier, } nSpec, err := executeLua(data, script) if err != nil { @@ -750,11 +751,12 @@ func TestLuaScript(t *testing.T) { Annotations: testCase.Original.GetAnnotations(), Spec: testCase.Original.Object["spec"], }, - Matches: matches, - CanaryWeight: *weight, - StableWeight: 100 - *weight, - CanaryService: canaryService, - StableService: stableService, + Matches: matches, + CanaryWeight: *weight, + StableWeight: 100 - *weight, + CanaryService: canaryService, + StableService: stableService, + RequestHeaderModifier: trafficRouting.Spec.Strategy.RequestHeaderModifier, } nSpec, err := executeLua(data, script) if err != nil {