Skip to content

Commit

Permalink
fix: flaky cmd test
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Sep 18, 2024
1 parent 2347f2c commit 911d126
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/cmd/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ func TestCommandCreate(t *testing.T) {
commands, err := db.ListCommands(ctx)
require.NoError(t, err)
require.Equal(t, 2, len(commands))

// zero out timestamps for comparison. this is because time.Time's
// internal representation is not stable across
// serialization/deserialization
c1.ExecutedAt = time.Time{}
c1.CompletedAt = time.Time{}
c2.ExecutedAt = time.Time{}
c2.CompletedAt = time.Time{}
for i := range commands {
commands[i].ExecutedAt = time.Time{}
commands[i].CompletedAt = time.Time{}
}

require.Equal(t, c1.Command, commands[0].Command)
require.Equal(t, c2.Command, commands[1].Command)
}

0 comments on commit 911d126

Please sign in to comment.