Skip to content

Commit

Permalink
fix: Asserts order deterministically (aws#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliot-smith authored and tneely committed Nov 11, 2021
1 parent cb14e32 commit c28760d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/cli/internal/pkg/aws/cwl/get_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,18 @@ func TestClient_GetLogs(t *testing.T) {
logs, err := output.NextLogs()
assert.False(t, output.HasMoreLogs())
assert.NoError(t, err)
assert.Equal(t, []string{
fmt.Sprintf("%s\tHello", eventTime1.Format(time.RFC1123Z)),
fmt.Sprintf("%s\tworld!", eventTime2.Format(time.RFC1123Z)),
fmt.Sprintf("%s\tHola", eventTime1.Format(time.RFC1123Z)),
fmt.Sprintf("%s\tmundo!", eventTime2.Format(time.RFC1123Z)),

englishHelloLog, spanishHelloLog := fmt.Sprintf("%s\tHello", eventTime1.Format(time.RFC1123Z)), fmt.Sprintf("%s\tHola", eventTime1.Format(time.RFC1123Z))
englishWorldLog, spanishWorldLog := fmt.Sprintf("%s\tworld!", eventTime2.Format(time.RFC1123Z)), fmt.Sprintf("%s\tmundo!", eventTime2.Format(time.RFC1123Z))
assert.ElementsMatch(t, []string{
englishHelloLog,
englishWorldLog,
spanishHelloLog,
spanishWorldLog,
}, logs)

assert.Contains(t, []string{englishHelloLog, spanishHelloLog}, logs[0])
assert.Contains(t, []string{englishHelloLog, spanishHelloLog}, logs[2])
}

func TestClient_GetLogs_Error(t *testing.T) {
Expand Down

0 comments on commit c28760d

Please sign in to comment.