diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2ae8ce5ff..ea2f418b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -119,14 +119,6 @@ jobs: outputs: type=docker,dest=${{ github.workspace }}/flagd-local.tar tags: flagd-local:test - - name: Load & run flagd image - run: | - docker load --input ${{ github.workspace }}/flagd-local.tar - docker run -d -p 8013:8013 -v ${{ github.workspace }}/test-harness/testing-flags.json:/testing-flags.json flagd-local:test start -f file:/testing-flags.json - - - name: Integration tests - run: make integration-test - - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: @@ -140,3 +132,26 @@ jobs: uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2 with: sarif_file: "trivy-results.sarif" + + integration-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 + with: + submodules: recursive + + - name: Setup go + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Build flagd binary + run: make build + + - name: Run flagd binary in background + run: ./flagd start -f file:${{ github.workspace }}/test-harness/symlink_testing-flags.json & + + - name: Run tests + run: make integration-test diff --git a/Makefile b/Makefile index 5aa56cdc1..6e97011ed 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ build: go build -ldflags "-X main.version=dev -X main.commit=$$(git rev-parse --short HEAD) -X main.date=$$(date +%FT%TZ)" -o flagd test: go test -race -covermode=atomic -cover -short ./pkg/... -coverprofile=coverage.out -integration-test: # dependent on: docker run -p 8013:8013 -v $PWD/test-harness/testing-flags.json:/testing-flags.json ghcr.io/open-feature/flagd:latest start -f file:/testing-flags.json +integration-test: # dependent on: ./flagd start -f file:test-harness/symlink_testing-flags.json go test -cover ./tests/integration $(ARGS) cd test-harness; git restore testing-flags.json # reset testing-flags.json run: diff --git a/go.mod b/go.mod index f59030e3f..f7e8eb40b 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/golang/mock v1.6.0 github.com/mattn/go-colorable v0.1.13 github.com/open-feature/go-sdk-contrib/providers/flagd v0.1.7 - github.com/open-feature/go-sdk-contrib/tests/flagd v1.1.0 + github.com/open-feature/go-sdk-contrib/tests/flagd v1.2.0 github.com/open-feature/open-feature-operator v0.2.28 github.com/open-feature/schemas v0.2.8 github.com/prometheus/client_golang v1.14.0 diff --git a/go.sum b/go.sum index 946ae7cc6..85361d209 100644 --- a/go.sum +++ b/go.sum @@ -319,6 +319,8 @@ github.com/open-feature/go-sdk-contrib/providers/flagd v0.1.7 h1:0s8reX/EfCNV37P github.com/open-feature/go-sdk-contrib/providers/flagd v0.1.7/go.mod h1:dHB0hsYykZ1Un+CdnWErqLqUQswUADIvDg2VwDLx7gs= github.com/open-feature/go-sdk-contrib/tests/flagd v1.1.0 h1:lM+7hfFVwUxQPOyJ9rXn2UR4sCAfOQJKtCU29pU/B+4= github.com/open-feature/go-sdk-contrib/tests/flagd v1.1.0/go.mod h1:zw/xpuDy9ziBEKVA1t4VoQtzFc80btAAQCiZkX6y9oQ= +github.com/open-feature/go-sdk-contrib/tests/flagd v1.2.0 h1:PBCaJIK6fb5+27m+yBEmjIkLRJ+yZx72mHjcrcy73+Y= +github.com/open-feature/go-sdk-contrib/tests/flagd v1.2.0/go.mod h1:zw/xpuDy9ziBEKVA1t4VoQtzFc80btAAQCiZkX6y9oQ= github.com/open-feature/open-feature-operator v0.2.28 h1:qzzVq8v9G7aXO7luocO/wQCGnTJjtcQh75mDOqjnFxo= github.com/open-feature/open-feature-operator v0.2.28/go.mod h1:bQncVK7hvhj5QStPwexxQ1aArPwox2Y1vWrVei/qIFg= github.com/open-feature/schemas v0.2.8 h1:oA75hJXpOd9SFgmNI2IAxWZkwzQPUDm7Jyyh3q489wM= diff --git a/test-harness b/test-harness index 6660aa3e1..b59af3d55 160000 --- a/test-harness +++ b/test-harness @@ -1 +1 @@ -Subproject commit 6660aa3e11a4da38d0a66f8920ad674599a3b681 +Subproject commit b59af3d554781c35d75433167c6948f62c458953 diff --git a/tests/integration/README.md b/tests/integration/README.md index 3a7069552..9d8394224 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -11,7 +11,7 @@ make build ``` then run the `flagd` binary ``` -./flagd start -f file:test-harness/testing-flags.json +./flagd start -f file:test-harness/symlink_testing-flags.json ``` and finally run ``` @@ -35,7 +35,7 @@ make build ``` then run the `flagd` binary with tls configuration ``` -./flagd start -f file:test-harness/testing-flags.json -c ./localhost.crt -k ./localhost.key +./flagd start -f file:test-harness/symlink_testing-flags.json -c ./localhost.crt -k ./localhost.key ``` finally, either run the tests with an explicit path to the certificate: ``` diff --git a/tests/integration/caching_test.go b/tests/integration/caching_test.go index e843ad354..029f4e2c8 100644 --- a/tests/integration/caching_test.go +++ b/tests/integration/caching_test.go @@ -10,7 +10,11 @@ import ( "github.com/cucumber/godog" ) -const flagConfigurationPath = "../../test-harness/testing-flags.json" +const ( + flagConfigurationPath = "../../test-harness/symlink_testing-flags.json" + flagConfigurationTargetFilePath = "../../test-harness/testing-flags.json" + flagConfigurationMutatedPath = "../../test-harness/mutated-testing-flags.json" +) func TestCaching(t *testing.T) { if testing.Short() { @@ -27,7 +31,8 @@ func TestCaching(t *testing.T) { providerOptions = []flagd.ProviderOption{flagd.WithTLS(certPath)} } - initializeCachingScenario, err := integration.InitializeCachingScenario(flagConfigurationPath, providerOptions...) + initializeCachingScenario, err := integration.InitializeCachingScenario( + flagConfigurationTargetFilePath, flagConfigurationPath, flagConfigurationMutatedPath, providerOptions...) if err != nil { t.Fatal(err) }