@@ -808,6 +808,7 @@ func TestStackGenerateRouteGroup(t *testing.T) {
808808func TestStackGenerateRouteGroupSegment (t * testing.T ) {
809809 for _ , tc := range []struct {
810810 rgSpec * zv1.RouteGroupSpec
811+ stackAnnotations map [string ]string
811812 lowerLimit float64
812813 upperLimit float64
813814 expectNil bool
@@ -900,6 +901,23 @@ func TestStackGenerateRouteGroupSegment(t *testing.T) {
900901 "example.teapot.zalan.do" ,
901902 },
902903 },
904+ {
905+ rgSpec : & zv1.RouteGroupSpec {
906+ Hosts : []string {"example.teapot.zalan.do" },
907+ Routes : []rgv1.RouteGroupRouteSpec {{}},
908+ },
909+ stackAnnotations : map [string ]string {
910+ forwardBackendAnnotation : forwardBackendName ,
911+ },
912+ lowerLimit : 0.1 ,
913+ upperLimit : 0.3 ,
914+ expectNil : false ,
915+ expectError : false ,
916+ expectedPredicate : "TrafficSegment(0.10, 0.30)" ,
917+ expectedHosts : []string {
918+ "example.teapot.zalan.do" ,
919+ },
920+ },
903921 } {
904922 backendPort := intstr .FromInt (int (80 ))
905923 c := & StackContainer {
@@ -911,6 +929,13 @@ func TestStackGenerateRouteGroupSegment(t *testing.T) {
911929 segmentUpperLimit : tc .upperLimit ,
912930 backendPort : & backendPort ,
913931 }
932+ if tc .stackAnnotations != nil {
933+ if c .Stack .Annotations != nil {
934+ maps .Copy (c .Stack .Annotations , tc .stackAnnotations )
935+ } else {
936+ c .Stack .Annotations = tc .stackAnnotations
937+ }
938+ }
914939 rg , err := c .GenerateRouteGroupSegment ()
915940
916941 if (err != nil ) != tc .expectError {
0 commit comments