Skip to content

Commit

Permalink
all: Fix experimental definition tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansmares committed Nov 9, 2023
1 parent 849badf commit a4b9249
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/experimental/experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
)

func TestExperimentalFeatures(t *testing.T) {
t.Parallel()

a := assertions.New(t)

r := NewRegistry()
Expand All @@ -32,21 +34,21 @@ func TestExperimentalFeatures(t *testing.T) {

feature := DefineFeature("experimental.feature", false)
a.So(feature.GetValue(ctx), should.BeFalse)
a.So(AllFeatures(ctx), should.Resemble, map[string]bool{"experimental.feature": false})
a.So(AllFeatures(ctx)["experimental.feature"], should.BeFalse)
a.So(feature.GetValue(context.Background()), should.BeFalse)
a.So(AllFeatures(context.Background()), should.Resemble, map[string]bool{"experimental.feature": false})
a.So(AllFeatures(context.Background())["experimental.feature"], should.BeFalse)

r.EnableFeatures("experimental.feature")
a.So(feature.GetValue(ctx), should.BeTrue)
a.So(AllFeatures(ctx), should.Resemble, map[string]bool{"experimental.feature": true})
a.So(AllFeatures(ctx)["experimental.feature"], should.BeTrue)
a.So(feature.GetValue(context.Background()), should.BeFalse)
a.So(AllFeatures(context.Background()), should.Resemble, map[string]bool{"experimental.feature": false})
a.So(AllFeatures(context.Background())["experimental.feature"], should.BeFalse)

EnableFeatures("experimental.feature")
r.DisableFeatures("experimental.feature")

a.So(feature.GetValue(ctx), should.BeFalse)
a.So(AllFeatures(ctx), should.Resemble, map[string]bool{"experimental.feature": false})
a.So(AllFeatures(ctx)["experimental.feature"], should.BeFalse)
a.So(feature.GetValue(context.Background()), should.BeTrue)
a.So(AllFeatures(context.Background()), should.Resemble, map[string]bool{"experimental.feature": true})
a.So(AllFeatures(context.Background())["experimental.feature"], should.BeTrue)
}

0 comments on commit a4b9249

Please sign in to comment.