diff --git a/core/pkg/evaluator/fractional.go b/core/pkg/evaluator/fractional.go index 0163e0929..5d3973789 100644 --- a/core/pkg/evaluator/fractional.go +++ b/core/pkg/evaluator/fractional.go @@ -61,7 +61,7 @@ func parseFractionalEvaluationData(values, data any, logger *logger.Logger) (str if !ok { return "", nil, errors.New("fractional evaluation data is not an array") } -if len(valuesArray) < 1 { + if len(valuesArray) < 1 { return "", nil, errors.New("fractional evaluation data must contain at least one distribution") } @@ -195,7 +195,7 @@ func parseFractionalEvaluationDistributions(values []any, data any, logger *logg // It maps a 32-bit hash to the range [0, totalWeight) and finds the variant bucket that contains that value. func distributeValue(hashValue uint32, feDistribution *fractionalEvaluationDistribution) any { if feDistribution.totalWeight == 0 { - return "" + return nil } bucket := (uint64(hashValue) * uint64(feDistribution.totalWeight)) >> 32 @@ -209,5 +209,5 @@ func distributeValue(hashValue uint32, feDistribution *fractionalEvaluationDistr } // unreachable given validation - return "" + return nil } diff --git a/core/pkg/evaluator/fractional_test.go b/core/pkg/evaluator/fractional_test.go index 6fcfa7ffb..789a626d4 100644 --- a/core/pkg/evaluator/fractional_test.go +++ b/core/pkg/evaluator/fractional_test.go @@ -1073,3 +1073,57 @@ func TestFractionalVariantBoolNumericAndOperators(t *testing.T) { }) } } + +func TestFractionalEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() + + tests := map[string]struct { + targeting string + context map[string]any + }{ + "missing bucket key falls back": { + targeting: `{ + "fractional": [ + {"var": "missing_key"}, + ["one", 50], + ["two", 50] + ] + }`, + context: map[string]any{}, + }, + "all zero weights fall back": { + targeting: `{ + "fractional": [ + {"var": "targetingKey"}, + ["one", 0], + ["two", 0] + ] + }`, + context: map[string]any{"targetingKey": "any-user"}, + }, + } + + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + je, err := setupEvaluator(source, []model.Flag{{ + Key: "fractional-op-error-fallback", + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "one": "one", + "two": "two", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}) + assert.NoError(t, err) + + value, variant, reason, _, err := resolve[string](ctx, "default", "fractional-op-error-fallback", tt.context, je.evaluateVariant) + assert.NoError(t, err) + assert.Equal(t, "fallback", value) + assert.Equal(t, "fallback", variant) + assert.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/core/pkg/evaluator/json.go b/core/pkg/evaluator/json.go index 428ff35c8..bb3cdc223 100644 --- a/core/pkg/evaluator/json.go +++ b/core/pkg/evaluator/json.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "regexp" "strings" "time" @@ -35,12 +34,6 @@ const ( ProtoVersionKey = "__flagd.protoVersion__" // used to mark if the request is coming from an older proto source, which has different fallback behavior ) -var regBrace *regexp.Regexp - -func init() { - regBrace = regexp.MustCompile("^[^{]*{|}[^}]*$") -} - func addSchemaResource(compiler *jsonschema.Compiler, url string, schemaData string) error { unmarshalJSON, err := jsonschema.UnmarshalJSON(strings.NewReader(schemaData)) if err != nil { @@ -548,13 +541,18 @@ func transposeEvaluators(state string) (string, error) { return "", fmt.Errorf("unmarshal: %w", err) } - for evalName, evalRaw := range evaluators.Evaluators { - // replace any occurrences of "evaluator": "evalName" - regex, err := regexp.Compile(fmt.Sprintf(`"\$ref":(\s)*"%s"`, evalName)) - if err != nil { - return "", fmt.Errorf("compile regex: %w", err) - } + // round-trip to normalize whitespace so we can use plain string matching + var raw interface{} + if err := json.Unmarshal([]byte(state), &raw); err != nil { + return "", fmt.Errorf("normalize: %w", err) + } + normalizedBytes, err := json.Marshal(raw) + if err != nil { + return "", fmt.Errorf("normalize marshal: %w", err) + } + result := string(normalizedBytes) + for evalName, evalRaw := range evaluators.Evaluators { marshalledEval, err := evalRaw.MarshalJSON() if err != nil { return "", fmt.Errorf("marshal evaluator: %w", err) @@ -564,9 +562,10 @@ func transposeEvaluators(state string) (string, error) { if len(evalValue) < 3 { return "", errors.New("evaluator object is empty") } - evalValue = regBrace.ReplaceAllString(evalValue, "") - state = regex.ReplaceAllString(state, evalValue) + + refPattern := `{"$ref":"` + evalName + `"}` + result = strings.ReplaceAll(result, refPattern, evalValue) } - return state, nil + return result, nil } diff --git a/core/pkg/evaluator/json_test.go b/core/pkg/evaluator/json_test.go index d9b988692..14993f0e0 100644 --- a/core/pkg/evaluator/json_test.go +++ b/core/pkg/evaluator/json_test.go @@ -1145,37 +1145,56 @@ func TestState_Evaluator(t *testing.T) { }, }, }, - "invalid evaluator json": { + "string-valued evaluator": { + // string-valued evaluators are valid; the string is substituted as-is (with quotes) inputState: ` { "flags": { - "fibAlgo": { - "variants": { - "recursive": "recursive", - "memo": "memo", - "loop": "loop", - "binet": "binet" - }, - "defaultVariant": "recursive", - "state": "ENABLED", - "metadata": { - "flagSetId": "flagSetId" - }, - "targeting": { - "if": [ - { - "$ref": "emailWithFaas" - }, "binet", null - ] - } - } + "fibAlgo": { + "variants": { + "recursive": "recursive", + "memo": "memo", + "loop": "loop", + "binet": "binet" + }, + "defaultVariant": "recursive", + "state": "ENABLED", + "metadata": { + "flagSetId": "flagSetId" + }, + "targeting": { + "if": [ + { + "$ref": "emailWithFaas" + }, "binet", null + ] + } + } + }, + "$evaluators": { + "emailWithFaas": "foo" + } + } + `, + expectedOutputState: map[string]model.Flag{ + "fibAlgo": { + Key: "fibAlgo", + Variants: map[string]any{ + "recursive": "recursive", + "memo": "memo", + "loop": "loop", + "binet": "binet", }, - "$evaluators": { - "emailWithFaas": "foo" - } - } - `, - expectedError: true, + DefaultVariant: "recursive", + State: "ENABLED", + Source: "testSource", + Targeting: json.RawMessage(`{"if":["foo","binet",null]}`), + Metadata: map[string]interface{}{ + "flagSetId": "flagSetId", + }, + FlagSetId: "flagSetId", + }, + }, }, "invalid targeting": { inputState: ` diff --git a/core/pkg/evaluator/semver.go b/core/pkg/evaluator/semver.go index 9d338a359..56327780d 100644 --- a/core/pkg/evaluator/semver.go +++ b/core/pkg/evaluator/semver.go @@ -85,12 +85,12 @@ func (je *SemVerComparison) SemVerEvaluation(values, _ interface{}) interface{} actualVersion, targetVersion, operator, err := parseSemverEvaluationData(values) if err != nil { je.Logger.Error(fmt.Sprintf("parse sem_ver evaluation data: %v", err)) - return false + return nil } res, err := operator.compare(actualVersion, targetVersion) if err != nil { je.Logger.Error(fmt.Sprintf("sem_ver evaluation: %v", err)) - return false + return nil } return res } @@ -105,7 +105,7 @@ func parseSemverEvaluationData(values interface{}) (string, string, SemVerOperat return "", "", "", errors.New("sem_ver evaluation must contain a value, an operator, and a comparison target") } - actualVersion, err := parseSemanticVersion(parsed[0]) + actualVersion, err := normalizeVersion(parsed[0]) if err != nil { return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse target property value: %w", err) } @@ -115,7 +115,7 @@ func parseSemverEvaluationData(values interface{}) (string, string, SemVerOperat return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse operator: %w", err) } - targetVersion, err := parseSemanticVersion(parsed[2]) + targetVersion, err := normalizeVersion(parsed[2]) if err != nil { return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse target value: %w", err) } @@ -131,11 +131,13 @@ func ensureString(v interface{}) string { return fmt.Sprintf("%v", v) } -func parseSemanticVersion(v interface{}) (string, error) { +func normalizeVersion(v interface{}) (string, error) { version := ensureString(v) // version strings are only valid in the semver package if they start with a 'v' // if it's not present in the given value, we prepend it + // 'V' is normalized to 'v' if !strings.HasPrefix(version, "v") { + version = strings.TrimPrefix(version, "V") version = "v" + version } diff --git a/core/pkg/evaluator/semver_test.go b/core/pkg/evaluator/semver_test.go index 0d25af9cc..47b61b371 100644 --- a/core/pkg/evaluator/semver_test.go +++ b/core/pkg/evaluator/semver_test.go @@ -2,12 +2,9 @@ package evaluator import ( "context" - "errors" "testing" - "github.com/open-feature/flagd/core/pkg/logger" "github.com/open-feature/flagd/core/pkg/model" - "github.com/open-feature/flagd/core/pkg/store" "github.com/stretchr/testify/require" ) @@ -83,6 +80,16 @@ func TestSemVerOperator_Compare(t *testing.T) { want: true, wantErr: false, }, + { + name: "uppercase V prefix equals lowercase or no prefix", + svo: Equals, + args: args{ + v1: "V1.0.0", + v2: "1.0.0", + }, + want: true, + wantErr: false, + }, { name: "no prefixed v both", svo: Greater, @@ -320,15 +327,7 @@ func TestJSONEvaluator_semVerEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "versions and operator provided - match": { flags: []model.Flag{{ Key: "headerColor", @@ -789,34 +788,27 @@ func TestJSONEvaluator_semVerEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) +} - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } +func TestSemVerEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() - if !errors.Is(err, tt.expectedError) { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) + tests := map[string]errorFallbackTestCase{ + "invalid context version falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "=", "1.0.0"]}`, + context: map[string]any{"version": "not-a-version"}, + }, + "invalid operator falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "===", "1.0.0"]}`, + context: map[string]any{"version": "1.0.0"}, + }, + "wrong arg count falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "="]}`, + context: map[string]any{"version": "1.0.0"}, + }, } + + runErrorFallbackTests(t, ctx, source, "semver-op-error-fallback", tests) } diff --git a/core/pkg/evaluator/string_comparison.go b/core/pkg/evaluator/string_comparison.go index d4a0d6b7c..9449b9430 100644 --- a/core/pkg/evaluator/string_comparison.go +++ b/core/pkg/evaluator/string_comparison.go @@ -72,7 +72,7 @@ func (sce *StringComparisonEvaluator) EndsWithEvaluation(values, _ interface{}) propertyValue, target, err := parseStringComparisonEvaluationData(values) if err != nil { sce.Logger.Error(fmt.Sprintf("parse ends_with evaluation data: %v", err)) - return false + return nil } return strings.HasSuffix(propertyValue, target) } diff --git a/core/pkg/evaluator/string_comparison_test.go b/core/pkg/evaluator/string_comparison_test.go index 01905a446..9049caf15 100644 --- a/core/pkg/evaluator/string_comparison_test.go +++ b/core/pkg/evaluator/string_comparison_test.go @@ -2,13 +2,10 @@ package evaluator import ( "context" - "errors" "fmt" "testing" - "github.com/open-feature/flagd/core/pkg/logger" "github.com/open-feature/flagd/core/pkg/model" - "github.com/open-feature/flagd/core/pkg/store" "github.com/stretchr/testify/assert" ) @@ -17,21 +14,13 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "two strings provided - match": { flags: []model.Flag{{ Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -55,7 +44,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -79,7 +68,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -103,7 +92,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -127,7 +116,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -148,36 +137,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } - - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } - - if !errors.Is(err, tt.expectedError) { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) } func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { @@ -185,21 +145,13 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "two strings provided - match": { flags: []model.Flag{{ Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -223,7 +175,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -247,7 +199,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -271,7 +223,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -295,7 +247,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -316,36 +268,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } - - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } - - if err != tt.expectedError { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) } func Test_parseStringComparisonEvaluationData(t *testing.T) { @@ -431,3 +354,21 @@ func Test_parseStringComparisonEvaluationData(t *testing.T) { }) } } + +func TestStringComparisonEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() + + tests := map[string]errorFallbackTestCase{ + "starts_with invalid input falls back": { + targeting: `{"starts_with": [{"var": "num"}, "abc"]}`, + context: map[string]any{"num": 123.0}, + }, + "ends_with invalid input falls back": { + targeting: `{"ends_with": [{"var": "num"}, "xyz"]}`, + context: map[string]any{"num": 123.0}, + }, + } + + runErrorFallbackTests(t, ctx, source, "string-op-error-fallback", tests) +} diff --git a/core/pkg/evaluator/utils_test.go b/core/pkg/evaluator/utils_test.go index 3a9cde66d..d466d364a 100644 --- a/core/pkg/evaluator/utils_test.go +++ b/core/pkg/evaluator/utils_test.go @@ -1,8 +1,84 @@ package evaluator +import ( + "context" + "testing" + + "github.com/open-feature/flagd/core/pkg/logger" + "github.com/open-feature/flagd/core/pkg/model" + "github.com/open-feature/flagd/core/pkg/store" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + var colorVariants = map[string]any{ "red": "#FF0000", "blue": "#0000FF", "green": "#00FF00", "yellow": "#FFFF00", } + +type stringFlagEvalTestCase struct { + flags []model.Flag + flagKey string + context map[string]any + expectedValue string + expectedVariant string + expectedReason string + expectedError error +} + +func runStringFlagEvalTests(t *testing.T, ctx context.Context, source string, sources []string, tests map[string]stringFlagEvalTestCase) { + t.Helper() + const reqID = "default" + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, sources) + require.NoError(t, err) + je := NewJSON(log, s) + je.store.Update(source, tt.flags, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) + + assert.Equal(t, tt.expectedValue, value) + assert.Equal(t, tt.expectedVariant, variant) + assert.Equal(t, tt.expectedReason, reason) + assert.ErrorIs(t, err, tt.expectedError) + }) + } +} + +type errorFallbackTestCase struct { + targeting string + context map[string]any +} + +func runErrorFallbackTests(t *testing.T, ctx context.Context, source, flagKey string, tests map[string]errorFallbackTestCase) { + t.Helper() + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, []string{source}) + require.NoError(t, err) + je := NewJSON(log, s) + je.store.Update(source, []model.Flag{{ + Key: flagKey, + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "true": "true", + "false": "false", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, "default", flagKey, tt.context, je.evaluateVariant) + assert.NoError(t, err) + assert.Equal(t, "fallback", value) + assert.Equal(t, "fallback", variant) + assert.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/test-harness b/test-harness index 2684a3ecf..190307b3b 160000 --- a/test-harness +++ b/test-harness @@ -1 +1 @@ -Subproject commit 2684a3ecf061002221a8be7d09e9c8f915c7b193 +Subproject commit 190307b3b1982773976f05464942f69bb23528a4 diff --git a/test/integration/go.mod b/test/integration/go.mod index a79c0a3f8..e44c344a9 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -5,7 +5,7 @@ go 1.25.5 require ( github.com/go-git/go-git/v5 v5.18.0 - github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0 + github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0 github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2 github.com/testcontainers/testcontainers-go v0.41.0 ) @@ -115,7 +115,7 @@ require ( github.com/morikuni/aec v1.1.0 // indirect github.com/onsi/gomega v1.35.1 // indirect github.com/open-feature/flagd-schemas v0.2.13 // indirect - github.com/open-feature/flagd/core v0.14.0 // indirect + github.com/open-feature/flagd/core v0.15.0 // indirect github.com/open-feature/go-sdk v1.17.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect @@ -158,10 +158,10 @@ require ( go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect go.opentelemetry.io/otel v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect go.opentelemetry.io/otel/metric v1.43.0 // indirect go.opentelemetry.io/otel/sdk v1.43.0 // indirect @@ -170,7 +170,7 @@ require ( go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect golang.org/x/crypto v0.49.0 // indirect diff --git a/test/integration/go.sum b/test/integration/go.sum index 118dada17..8f7d4d37c 100644 --- a/test/integration/go.sum +++ b/test/integration/go.sum @@ -253,8 +253,9 @@ github.com/hashicorp/go-memdb v1.3.5/go.mod h1:8IVKKBkVe+fxFgdFOYxzQQNjz+sWCyHCd github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4= github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -343,12 +344,12 @@ github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/open-feature/flagd-schemas v0.2.13 h1:LzoyQfirfpR8cxI4PKnoFRtpwPjpC/cOO8N0n8dpbRc= github.com/open-feature/flagd-schemas v0.2.13/go.mod h1:C0jnJ4C3j2LzGuqKgLDdTsdfKEWQp6sOHZyxu3QohFU= -github.com/open-feature/flagd/core v0.14.0 h1:eGjPKONDjGa0+Pkxi6XiTdusFUCN3EuF7b1aebcDPvM= -github.com/open-feature/flagd/core v0.14.0/go.mod h1:G1KZQoSD0gi6JMVwcZxHhzOhs/WnhoyPjZneqej1neI= +github.com/open-feature/flagd/core v0.15.0 h1:y8ZEj1Ia8xHQiSugoRpWW4t1kvc+l5bLqWwPzO5avr0= +github.com/open-feature/flagd/core v0.15.0/go.mod h1:J+Hz06ZMPymRiXR9WGA/nMYjtVKzuHC9LSrz81GxJIE= github.com/open-feature/go-sdk v1.17.0 h1:/OUBBw5d9D61JaNZZxb2Nnr5/EJrEpjtKCTY3rspJQk= github.com/open-feature/go-sdk v1.17.0/go.mod h1:lPxPSu1UnZ4E3dCxZi5gV3et2ACi8O8P+zsTGVsDZUw= -github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0 h1:FHcz/EQ+WtPrbrtB9XBbrOKnpXk2sHyIwLo7pFt2wm4= -github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0/go.mod h1:HcsGB/b695L9PZX9fZwpWU72tFQaj0wADbthStDaajE= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0 h1:+zYgmk5JOhfaco0gnQ2gqAlGC6MTlIS0RN0ishPun6c= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0/go.mod h1:bzGZZSSFPOkvptyFUOhZPUtjK0thkgNDOvQ4UcgUi/g= github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2 h1:deCtDKh3QKh6WXKDe6HzF6Gm01ZltVSF0JV5GhZbuRI= github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2/go.mod h1:oRuJpK7H5Alg8D3xGU2f/xJK/UqUqODIwhLMol6yo1Q= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -380,10 +381,10 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= -github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= +github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -496,14 +497,14 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 h1:MdKucPl/HbzckWWEisiNqMPhRrAOQX8r4jTuGr636gk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0/go.mod h1:RolT8tWtfHcjajEH5wFIZ4Dgh5jpPdFXYV9pTAk/qjc= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 h1:w1K+pCJoPpQifuVpsKamUdn9U0zM3xUziVOqsGksUrY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0/go.mod h1:HBy4BjzgVE8139ieRI75oXm3EcDN+6GhD88JT1Kjvxg= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJKlCZufyRzPzlQhUIWVmfltrXuGyfjREgGP3UUjc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak= go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= @@ -522,8 +523,8 @@ go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 48742626b..d286293e7 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -199,8 +199,13 @@ func TestInProcess(t *testing.T) { "./", } - // Run tests with InProcess-specific tags - tags := "@in-process && ~@unixsocket&& ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v2 && ~@fractional-nested && ~@deprecated" + // Run tests with InProcess-specific tags. + // These tests use the published go-sdk-contrib in-process provider (see sibling go.mod), + // not the local flagd evaluator code. The goal is to verify the sync.proto interface, + // not to fully test the go in-process provider (that happens in go-sdk-contrib). + // Many tags are excluded because they require a more complex testbed than what's built here. + // TODO: remove ~@operator-errors and ~@semver-v-prefix once go-sdk-contrib picks up the fixes + tags := "@in-process && ~@unixsocket && ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v1 && ~@fractional-single-entry && ~@deprecated && ~@operator-errors && ~@semver-v-prefix" if err := runner.RunGherkinTestsWithSubtests(t, featurePaths, tags); err != nil { t.Fatalf("Gherkin tests failed: %v", err)