Skip to content

Commit

Permalink
fix(sql): Fix intermittently failing tests (#2788)
Browse files Browse the repository at this point in the history
Some of the execution repository tests assert the ordering of
executions retreived from the database, but ULIDs are only
monotonic with millisecond resolution. The fix has been to sleep
for 1ms beteween creating executions, which mostly fixed the tests
but there are still occasional failures where two executions have
the same timestamp bits in their ULID.

To reduce these failures, just wait 5ms between adding executions to
the database.
  • Loading branch information
ezimanyi authored Mar 25, 2019
1 parent 0f9be8d commit a8a08a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ abstract class ExecutionRepositoryTck<T extends ExecutionRepository> extends Spe
when:
repository.store(runningExecution)
// our ULID implementation isn't monotonic
sleep(1)
sleep(5)
repository.store(succeededExecution)
def orchestrations = repository.retrieveOrchestrationsForApplication(
runningExecution.application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class SqlExecutionRepositorySpec extends ExecutionRepositoryTck<SqlExecutionRepo
name = "Orchestration #${i + 1}"
})
// our ULID implementation isn't monotonic
sleep(1)
sleep(5)
}

when:
Expand Down Expand Up @@ -351,7 +351,7 @@ class SqlExecutionRepositorySpec extends ExecutionRepositoryTck<SqlExecutionRepo
name = "Orchestration #${i + 1}"
})
// our ULID implementation isn't monotonic
sleep(1)
sleep(5)
}

when:
Expand Down Expand Up @@ -384,7 +384,7 @@ class SqlExecutionRepositorySpec extends ExecutionRepositoryTck<SqlExecutionRepo
name = "Orchestration #${i + 1}"
})
// our ULID implementation isn't monotonic
sleep(1)
sleep(5)
}

when:
Expand Down

0 comments on commit a8a08a9

Please sign in to comment.