Skip to content

Commit

Permalink
fix(test): flakey test (#738)
Browse files Browse the repository at this point in the history
Signed-off-by: Julie Vogelmani <[email protected]>
  • Loading branch information
juliev0 authored and whynowy committed May 30, 2023
1 parent 260a154 commit ccf79c6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/sources/redisstreams/redisstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestProduceMsg(t *testing.T) {
testCase string
inMsg redis.XMessage
expectedBody string
expectedKeys []string // in order
expectedKeys map[string]struct{} // essentially a Set
expectedTime time.Time
}{
{
Expand All @@ -42,7 +42,7 @@ func TestProduceMsg(t *testing.T) {
},
},
`{"humidity":"50","temperature":"60"}`,
[]string{"humidity", "temperature"},
map[string]struct{}{"humidity": {}, "temperature": {}},
time.Date(2018, 2, 18, 10, 58, 0, 106000000, time.UTC),
},
{
Expand All @@ -54,7 +54,7 @@ func TestProduceMsg(t *testing.T) {
},
},
`{"humidity":"50"}`,
[]string{"humidity"},
map[string]struct{}{"humidity": {}},
time.Date(2018, 2, 18, 10, 58, 0, 106000000, time.UTC),
},
}
Expand All @@ -65,8 +65,9 @@ func TestProduceMsg(t *testing.T) {
assert.NotNil(t, outMsg)
assert.Nil(t, err)
assert.Equal(t, tt.expectedBody, string(outMsg.Payload))
for i, key := range tt.expectedKeys {
assert.Equal(t, key, outMsg.Keys[i])
assert.Equal(t, len(tt.expectedKeys), len(outMsg.Keys))
for key := range tt.expectedKeys {
assert.Contains(t, outMsg.Keys, key)
}
assert.Equal(t, tt.expectedTime.Local(), outMsg.EventTime)
})
Expand Down

0 comments on commit ccf79c6

Please sign in to comment.