Unleash / unleash-client-go

Unleash client SDK for Go
https://docs.getunleash.io
Apache License 2.0
138 stars 55 forks source link

feat: add FeatureEnabled to Variant and fix spec testing #166

Closed jameshartig closed 10 months ago

jameshartig commented 10 months ago

About the changes

FeatureEnabled is similar to Enabled except in the case where the feature is enabled but there are no variants defined. This follows the client specification case [1].

[1] https://github.com/Unleash/client-specification/blob/c0169d7ace35db66cdf41a7b1b4e390a4a843c3b/specifications/08-variants.json#L448

Closes #159

Important files

Discussion points

See https://github.com/Unleash/unleash-client-go/pull/165#issuecomment-1854245853 but I'm not sure how to handle the JSON differences between the spec and *api.Variant.

jameshartig commented 10 months ago

@FredrikOseberg took my best shot at fixing the spec tests and they seem to pass locally now.

FredrikOseberg commented 10 months ago

@jameshartig Thanks. We don't have detailed documentation about our specification tests, but it's basically a set of tests that we use to ensure SDK compatibility across languages. Nice work on setting it up, finding the error and fixing it.

I noticed a flaw in our current workflow that only built and ran the tests when a push was made by someone with write access to the repository, so I added a new workflow that builds PRs and changed the other workflow to run on main. All the checks pass now!