@@ -308,7 +308,8 @@ func TestSplitWithoutConfigurations(t *testing.T) {
308308 nil ,
309309 logger ,
310310 syncProxyFeatureFlagsRules ,
311- syncProxyRuleBasedSegmentRules )
311+ syncProxyRuleBasedSegmentRules ,
312+ nil )
312313
313314 key := "test"
314315 result := evaluator .EvaluateFeature (key , & key , "mysplittest" , nil )
@@ -333,7 +334,8 @@ func TestSplitWithtConfigurations(t *testing.T) {
333334 nil ,
334335 logger ,
335336 syncProxyFeatureFlagsRules ,
336- syncProxyRuleBasedSegmentRules )
337+ syncProxyRuleBasedSegmentRules ,
338+ nil )
337339
338340 key := "test"
339341 result := evaluator .EvaluateFeature (key , & key , "mysplittest2" , nil )
@@ -358,7 +360,8 @@ func TestSplitWithtConfigurationsButKilled(t *testing.T) {
358360 nil ,
359361 logger ,
360362 syncProxyFeatureFlagsRules ,
361- syncProxyRuleBasedSegmentRules )
363+ syncProxyRuleBasedSegmentRules ,
364+ nil )
362365
363366 key := "test"
364367 result := evaluator .EvaluateFeature (key , & key , "mysplittest3" , nil )
@@ -383,7 +386,8 @@ func TestSplitWithConfigurationsButKilledWithConfigsOnDefault(t *testing.T) {
383386 nil ,
384387 logger ,
385388 syncProxyFeatureFlagsRules ,
386- syncProxyRuleBasedSegmentRules )
389+ syncProxyRuleBasedSegmentRules ,
390+ nil )
387391
388392 key := "test"
389393 result := evaluator .EvaluateFeature (key , & key , "mysplittest4" , nil )
@@ -399,6 +403,14 @@ func TestSplitWithConfigurationsButKilledWithConfigsOnDefault(t *testing.T) {
399403
400404func TestMultipleEvaluations (t * testing.T ) {
401405 logger := logging .NewLogger (nil )
406+ fallbackTreatmentConfig := dtos.FallbackTreatmentConfig {GlobalFallbackTreatment : & dtos.FallbackTreatment {
407+ Treatment : "fallback" ,
408+ },
409+ ByFlagFallbackTreatment : map [string ]dtos.FallbackTreatment {
410+ "flag1" : {
411+ Treatment : "on" ,
412+ },
413+ }}
402414
403415 evaluator := NewEvaluator (
404416 & mockStorage {},
@@ -408,7 +420,8 @@ func TestMultipleEvaluations(t *testing.T) {
408420 nil ,
409421 logger ,
410422 syncProxyFeatureFlagsRules ,
411- syncProxyRuleBasedSegmentRules )
423+ syncProxyRuleBasedSegmentRules ,
424+ dtos .NewFallbackTreatmentCalculatorImp (& fallbackTreatmentConfig ))
412425
413426 key := "test"
414427 splits := []string {"mysplittest" , "mysplittest2" , "mysplittest3" , "mysplittest4" , "mysplittest5" }
@@ -442,7 +455,7 @@ func TestMultipleEvaluations(t *testing.T) {
442455 t .Error ("Unexpected configs" )
443456 }
444457
445- if result .Evaluations ["mysplittest5" ].Treatment != "control " {
458+ if result .Evaluations ["mysplittest5" ].Treatment != "fallback " {
446459 t .Error ("Wrong treatment result" )
447460 }
448461 if result .Evaluations ["mysplittest5" ].Config != nil {
@@ -467,7 +480,8 @@ func TestNoConditionMatched(t *testing.T) {
467480 nil ,
468481 logger ,
469482 syncProxyFeatureFlagsRules ,
470- syncProxyRuleBasedSegmentRules )
483+ syncProxyRuleBasedSegmentRules ,
484+ nil )
471485
472486 key := "test"
473487 result := evaluator .EvaluateFeature (key , & key , "some" , nil )
@@ -508,6 +522,15 @@ func TestEvaluationByFlagSets(t *testing.T) {
508522 },
509523 }
510524
525+ fallbackTreatmentConfig := dtos.FallbackTreatmentConfig {GlobalFallbackTreatment : & dtos.FallbackTreatment {
526+ Treatment : "fallback" ,
527+ },
528+ ByFlagFallbackTreatment : map [string ]dtos.FallbackTreatment {
529+ "mysplittest5" : {
530+ Treatment : "on" ,
531+ },
532+ }}
533+
511534 evaluator := NewEvaluator (
512535 mockedStorage ,
513536 nil ,
@@ -516,7 +539,8 @@ func TestEvaluationByFlagSets(t *testing.T) {
516539 nil ,
517540 logger ,
518541 syncProxyFeatureFlagsRules ,
519- syncProxyRuleBasedSegmentRules )
542+ syncProxyRuleBasedSegmentRules ,
543+ dtos .NewFallbackTreatmentCalculatorImp (& fallbackTreatmentConfig ))
520544 result := evaluator .EvaluateFeatureByFlagSets (key , & key , []string {"set1" , "set2" , "set3" }, nil )
521545
522546 if result .Evaluations ["mysplittest" ].Treatment != "off" {
@@ -547,7 +571,7 @@ func TestEvaluationByFlagSets(t *testing.T) {
547571 t .Error ("Unexpected configs" )
548572 }
549573
550- if result .Evaluations ["mysplittest5" ].Treatment != "control " {
574+ if result .Evaluations ["mysplittest5" ].Treatment != "on " {
551575 t .Error ("Wrong treatment result" )
552576 }
553577 if result .Evaluations ["mysplittest5" ].Config != nil {
@@ -652,6 +676,7 @@ func TestPrerequisitesMatching(t *testing.T) {
652676 logging .NewLogger (nil ),
653677 syncProxyFeatureFlagsRules ,
654678 syncProxyRuleBasedSegmentRules ,
679+ nil ,
655680 )
656681
657682 // Create split DTO with prerequisites
@@ -747,7 +772,8 @@ func TestEvaluationByFlagSetsASetEmpty(t *testing.T) {
747772 nil ,
748773 logger ,
749774 syncProxyFeatureFlagsRules ,
750- syncProxyRuleBasedSegmentRules )
775+ syncProxyRuleBasedSegmentRules ,
776+ nil )
751777 result := evaluator .EvaluateFeatureByFlagSets (key , & key , []string {"set2" }, nil )
752778
753779 if len (result .Evaluations ) != 0 {
0 commit comments