Skip to content

Commit

Permalink
chore: caching integration tests (#123)
Browse files Browse the repository at this point in the history
* chore: caching integration tests

Signed-off-by: Skye Gill <gill.skye95@gmail.com>
  • Loading branch information
skyerus authored Jan 16, 2023
1 parent 5124717 commit 6fc31aa
Show file tree
Hide file tree
Showing 9 changed files with 708 additions and 90 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ jobs:
test:
runs-on: ubuntu-latest

services:
flagd:
image: ghcr.io/open-feature/flagd-testbed:latest
ports:
- 8013:8013

steps:
- name: Install Go
uses: actions/setup-go@v3
Expand All @@ -50,6 +44,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- name: Run flagd-testbed
run: docker run -d -p 8013:8013 -v ${{ github.workspace }}/test-harness/testing-flags.json:/testing-flags.json ghcr.io/open-feature/flagd-testbed:v0.2.1
- name: Setup Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ mockgen:
mockgen -source=pkg/openfeature/mutex.go -destination=pkg/openfeature/mutex_mock_test.go -package=openfeature
test:
go test --short -cover ./...
integration-test: # dependent on `docker run -p 8013:8013 ghcr.io/open-feature/flagd-testbed:latest`
git submodule update --init --recursive
integration-test: # dependent on `docker run -p 8013:8013 -v $PWD/test-harness/testing-flags.json:/testing-flags.json ghcr.io/open-feature/flagd-testbed:latest`
go test -cover ./...
cd test-harness; git restore testing-flags.json; cd .. # reset testing-flags.json

lint:
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest
${GOPATH}/bin/golangci-lint run --deadline=3m --timeout=3m ./... # Run linters
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,19 @@ Run unit tests with `make test`.

#### Integration tests

The continuous integration runs a set of [gherkin integration tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using [`flagd`](https://github.com/open-feature/flagd).
If you'd like to run them locally, you can start the flagd testbed with `docker run -p 8013:8013 ghcr.io/open-feature/flagd-testbed:latest` and then run `make integration-test`.
The continuous integration runs a set of [gherkin integration tests](https://github.com/open-feature/test-harness/blob/main/features) using [`flagd`](https://github.com/open-feature/flagd).
If you'd like to run them locally, first pull the `test-harness` git submodule
```
git submodule update --init --recursive
```
then start the flagd testbed with
```
docker run -p 8013:8013 -v $PWD/test-harness/testing-flags.json:/testing-flags.json ghcr.io/open-feature/flagd-testbed:latest
```
and finally run
```
make integration-test
```

### Releases

Expand Down
44 changes: 31 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,51 @@ module github.com/open-feature/go-sdk

go 1.17

require (
github.com/golang/mock v1.6.0
golang.org/x/text v0.6.0
)

require (
github.com/cucumber/godog v0.12.6
github.com/go-logr/logr v1.2.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/open-feature/go-sdk-contrib/providers/flagd v0.0.0-20221011094516-34ac39f0e96d
github.com/open-feature/flagd v0.3.0
github.com/open-feature/go-sdk-contrib/providers/flagd v0.1.2
golang.org/x/text v0.4.0
)

require (
github.com/bufbuild/connect-go v0.4.0 // indirect
buf.build/gen/go/open-feature/flagd/bufbuild/connect-go v1.3.1-20221205151127-0e915b34a38d.1 // indirect
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.28.1-20221205151127-0e915b34a38d.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bufbuild/connect-go v1.4.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.2.6 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/open-feature/flagd v0.2.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/open-feature/schemas v0.0.0-20221123004631-302d0fa1f813 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.buf.build/open-feature/flagd-connect/open-feature/flagd v1.1.4 // indirect
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
google.golang.org/genproto v0.0.0-20220930163606-c98284e70a91 // indirect
google.golang.org/grpc v1.49.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Loading

0 comments on commit 6fc31aa

Please sign in to comment.