Skip to content

Commit

Permalink
test: make client test independet from the api (#302)
Browse files Browse the repository at this point in the history
Our client_test is not a unit test; we rely on the API to set the provider regularly, and within the code, we rely on the singleton. With these changes, we mock the API interface and provide it to the client's existing factory method. So each of the tests is independent from the others.

There are still some tests, which i would rather declare as e2e or integration tests, which i did not tackle, or where i do think it makes sense to keep them as is.

---------

Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Co-authored-by: Bernd Warmuth <bernd.warmuth@dynatrace.com>
  • Loading branch information
aepfli and warber authored Jan 7, 2025
1 parent d4fd8c2 commit 27ccd50
Show file tree
Hide file tree
Showing 7 changed files with 1,371 additions and 317 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mockgen:
mockgen -source=openfeature/provider.go -destination=openfeature/provider_mock_test.go -package=openfeature
mockgen -source=openfeature/hooks.go -destination=openfeature/hooks_mock_test.go -package=openfeature
mockgen -source=openfeature/interfaces.go -destination=openfeature/interfaces_mock_test.go -package=openfeature
test:
go test --short -cover ./...
e2e-test:
Expand Down
Loading

0 comments on commit 27ccd50

Please sign in to comment.