fix: general err if targeting variant not in variants (#1680)
This makes the RPC mode consistent with our in-process evaluations when
a variant is returned from targeting which is not in the variants list.
Relates to
758fbd5b84
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
This commit is contained in:
parent
961f9a6e13
commit
6cabfc8ff3
|
|
@ -390,7 +390,7 @@ func (je *Resolver) evaluateVariant(ctx context.Context, reqID string, flagKey s
|
||||||
}
|
}
|
||||||
je.Logger.ErrorWithID(reqID,
|
je.Logger.ErrorWithID(reqID,
|
||||||
fmt.Sprintf("invalid or missing variant: %s for flagKey: %s, variant is not valid", variant, flagKey))
|
fmt.Sprintf("invalid or missing variant: %s for flagKey: %s, variant is not valid", variant, flagKey))
|
||||||
return "", flag.Variants, model.ErrorReason, metadata, errors.New(model.ParseErrorCode)
|
return "", flag.Variants, model.ErrorReason, metadata, errors.New(model.GeneralErrorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if flag.DefaultVariant == "" {
|
if flag.DefaultVariant == "" {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ func TestLegacyFractionalEvaluation(t *testing.T) {
|
||||||
expectedVariant: "",
|
expectedVariant: "",
|
||||||
expectedValue: "",
|
expectedValue: "",
|
||||||
expectedReason: model.ErrorReason,
|
expectedReason: model.ErrorReason,
|
||||||
expectedErrorCode: model.ParseErrorCode,
|
expectedErrorCode: model.GeneralErrorCode,
|
||||||
},
|
},
|
||||||
"fallback to default variant if invalid variant as result of fractional evaluation": {
|
"fallback to default variant if invalid variant as result of fractional evaluation": {
|
||||||
flags: Flags{
|
flags: Flags{
|
||||||
|
|
@ -229,7 +229,7 @@ func TestLegacyFractionalEvaluation(t *testing.T) {
|
||||||
expectedVariant: "",
|
expectedVariant: "",
|
||||||
expectedValue: "",
|
expectedValue: "",
|
||||||
expectedReason: model.ErrorReason,
|
expectedReason: model.ErrorReason,
|
||||||
expectedErrorCode: model.ParseErrorCode,
|
expectedErrorCode: model.GeneralErrorCode,
|
||||||
},
|
},
|
||||||
"fallback to default variant if percentages don't sum to 100": {
|
"fallback to default variant if percentages don't sum to 100": {
|
||||||
flags: Flags{
|
flags: Flags{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue