Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,32 +124,5 @@ jobs:
with:
go-version-file: 'flagd/go.mod'

- name: Install envoy
run: |
wget -O- https://apt.envoyproxy.io/signing.key | sudo gpg --dearmor -o /etc/apt/keyrings/envoy-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/envoy-keyring.gpg] https://apt.envoyproxy.io jammy main" | sudo tee /etc/apt/sources.list.d/envoy.list
sudo apt-get update
sudo apt-get install envoy
envoy --version

- name: Workspace init
run: make workspace-init

- name: Build flagd binary
run: make build

- name: Run flagd binary in background
run: |
./bin/flagd start \
-f file:${{ github.workspace }}/test-harness/flags/testing-flags.json \
-f file:${{ github.workspace }}/test-harness/flags/custom-ops.json \
-f file:${{ github.workspace }}/test-harness/flags/evaluator-refs.json \
-f file:${{ github.workspace }}/test-harness/flags/zero-flags.json \
-f file:${{ github.workspace }}/test-harness/flags/edge-case-flags.json &

- name: Run envoy proxy in background
run: |
envoy -c ./test/integration/config/envoy.yaml &

- name: Run evaluation test suite
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Run evaluation test suite
- name: Run test suite

[Q] Its not only the evaluation test suite anymore, is it? Should we rename this? Open for other names too

run: make workspace-clean && cd test/integration && go clean -testcache && go test -cover
15 changes: 11 additions & 4 deletions flagd/pkg/service/flag-sync/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@
return fmt.Errorf("error constructing metadata response")
}

flagMap := s.convertMap(payload.Flags)

flags, err := json.Marshal(flagMap)
flags, err := s.generateResponse(payload.Flags)
if err != nil {
s.log.Error(fmt.Sprintf("error retrieving flags from store: %v", err))
return status.Error(codes.DataLoss, "error marshalling flags")
Expand All @@ -87,13 +85,22 @@
}
}

func (s syncHandler) generateResponse(payload []model.Flag) ([]byte, error) {
flagConfig := map[string]interface{}{
"flags": s.convertMap(payload),
}

flags, err := json.Marshal(flagConfig)
return flags, err
}

// getSelectorExpression extracts the selector expression from the request.
// It first checks the Flagd-Selector header (metadata), then falls back to the request body selector.
//
// The req parameter accepts *syncv1.SyncFlagsRequest or *syncv1.FetchAllFlagsRequest.
// Using interface{} here is intentional as both protobuf-generated types implement GetSelector()
// but do not share a common interface.
func (s syncHandler) getSelectorExpression(ctx context.Context, req interface{}) string {

Check warning on line 103 in flagd/pkg/service/flag-sync/handler.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the 'Get' prefix from this function name.

See more on https://sonarcloud.io/project/issues?id=open-feature_flagd&issues=AZrFqCt9RoKkkBAfb0Jb&open=AZrFqCt9RoKkkBAfb0Jb&pullRequest=1827
// Try to get selector from metadata (header)
if md, ok := metadata.FromIncomingContext(ctx); ok {
if values := md.Get(flagdService.FLAGD_SELECTOR_HEADER); len(values) > 0 {
Expand Down Expand Up @@ -139,7 +146,7 @@
return nil, status.Error(codes.Internal, "error retrieving flags from store")
}

flagsString, err := json.Marshal(s.convertMap(flags))
flagsString, err := s.generateResponse(flags)

if err != nil {
return nil, err
Expand All @@ -152,8 +159,8 @@

// Deprecated - GetMetadata is deprecated and will be removed in a future release.
// Use the sync_context field in syncv1.SyncFlagsResponse, providing same info.
func (s syncHandler) GetMetadata(_ context.Context, _ *syncv1.GetMetadataRequest) (

Check failure on line 162 in flagd/pkg/service/flag-sync/handler.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: syncv1.GetMetadataRequest is deprecated: Marked as deprecated in flagd/sync/v1/sync.proto. (staticcheck)

Check warning on line 162 in flagd/pkg/service/flag-sync/handler.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the 'Get' prefix from this function name.

See more on https://sonarcloud.io/project/issues?id=open-feature_flagd&issues=AZrFqCt9RoKkkBAfb0Jc&open=AZrFqCt9RoKkkBAfb0Jc&pullRequest=1827
*syncv1.GetMetadataResponse, error,

Check failure on line 163 in flagd/pkg/service/flag-sync/handler.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: syncv1.GetMetadataResponse is deprecated: Marked as deprecated in flagd/sync/v1/sync.proto. (staticcheck)
) {
if s.disableSyncMetadata {
return nil, status.Error(codes.Unimplemented, "metadata endpoint disabled")
Expand All @@ -169,7 +176,7 @@
return nil, fmt.Errorf("error constructing metadata response")
}

return &syncv1.GetMetadataResponse{

Check failure on line 179 in flagd/pkg/service/flag-sync/handler.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: syncv1.GetMetadataResponse is deprecated: Marked as deprecated in flagd/sync/v1/sync.proto. (staticcheck)
Metadata: metadata,
},
nil
Expand Down
2 changes: 1 addition & 1 deletion test-harness
49 changes: 0 additions & 49 deletions test/integration/config/envoy.yaml

This file was deleted.

76 changes: 0 additions & 76 deletions test/integration/evaluation_test.go

This file was deleted.

Loading
Loading