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
29 changes: 1 addition & 28 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
- name: Run test suite
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,6 +85,15 @@
}
}

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.
//
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)
*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