Skip to content

Commit

Permalink
test(storage/fs): add failing case around no rule distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed May 13, 2024
1 parent 802a54b commit 5e020a0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/testing/integration/readonly/readonly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ func TestReadOnly(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, true, response.Match)
assert.Equal(t, "flag_001", response.FlagKey)
assert.Equal(t, "flag_no_distributions", response.FlagKey)
assert.Equal(t, evaluation.EvaluationReason_MATCH_EVALUATION_REASON, response.Reason)
assert.Contains(t, response.SegmentKeys, "segment_001")
})
Expand Down
32 changes: 18 additions & 14 deletions internal/storage/fs/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,22 +603,27 @@ func (fis *FSIndexSuite) TestGetEvaluationDistributions() {
t := fis.T()

testCases := []struct {
name string
namespace string
flagKey string
expectedVariantName string
name string
namespace string
flagKey string
count int
}{
{
name: "Sandbox",
namespace: "sandbox",
flagKey: "sandbox-flag",
expectedVariantName: "sandbox-variant",
name: "Sandbox",
namespace: "sandbox",
flagKey: "sandbox-flag",
count: 1,
},
{
name: "Production",
namespace: "production",
flagKey: "prod-flag",
expectedVariantName: "prod-variant",
name: "Production",
namespace: "production",
flagKey: "prod-flag",
count: 1,
},
{
name: "Production No Distributions",
namespace: "production",
flagKey: "no-distributions",
},
}

Expand All @@ -632,8 +637,7 @@ func (fis *FSIndexSuite) TestGetEvaluationDistributions() {

require.NoError(t, err)

assert.Equal(t, tc.expectedVariantName, dist[0].VariantKey)
assert.Equal(t, float32(100), dist[0].Rollout)
assert.Len(t, dist, tc.count)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ flags:
threshold:
percentage: 50
value: true
- key: redemptory
name: redemptory
- key: no-distributions
name: No Distributions
description: description
enabled: true
variants:
- key: flipt-flag
rules:
- segment: segment1
- key: animalculine
name: animalculine
description: description
Expand Down

0 comments on commit 5e020a0

Please sign in to comment.