Skip to content

Commit adcf36d

Browse files
authored
fix(ci): Fix flaky TestIdentityGetAllFeatureStatesWithTraits (#166)
* Fix flaky TestIdentityGetAllFeatureStatesWithTraits allFeatureStates is built by iterating through a map, so we can't guarantee that segment_override will always be on the first element.
1 parent ee0cb7b commit adcf36d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

flagengine/engine_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ func TestIdentityGetAllFeatureStatesWithTraits(t *testing.T) {
110110
}
111111

112112
allFeatureStates := flagengine.GetIdentityFeatureStates(envWithSegmentOverride, identity, traitModels...)
113-
114-
assert.Equal(t, "segment_override", allFeatureStates[0].RawValue)
113+
found := false
114+
for _, fs := range allFeatureStates {
115+
if fs.RawValue == "segment_override" {
116+
found = true
117+
break
118+
}
119+
}
120+
assert.True(t, found, "expected to find feature state with segment_override value")
115121
}
116122

117123
func TestEnvironmentGetAllFeatureStates(t *testing.T) {

0 commit comments

Comments
 (0)