Skip to content

Commit

Permalink
Test only - Adjust timing in TestHistoryInsert.mariadb_simple_history()
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed May 12, 2022
1 parent c594750 commit 4b26048
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class TestHistoryInsert extends BaseTestCase {
public void mariadb_simple_history() {

Timestamp t0 = new Timestamp(System.currentTimeMillis());
littleSleep();
littleSleep(50);

User user = new User();
user.setName("Jim");
Expand All @@ -37,15 +37,16 @@ public void mariadb_simple_history() {
DB.save(user);
Timestamp t1 = new Timestamp(System.currentTimeMillis());

littleSleep();
littleSleep(100);
user.setName("NotJim");
user.save();
Timestamp t2 = new Timestamp(System.currentTimeMillis());

littleSleep();
littleSleep(100);
user.setName("NotJimV2");
user.setEmail("[email protected]");
user.save();
littleSleep(50);
Timestamp t3 = new Timestamp(System.currentTimeMillis());

List<Version<User>> versions = DB.find(User.class).setId(user.getId()).findVersionsBetween(t0, t3);
Expand All @@ -66,9 +67,9 @@ public void mariadb_simple_history() {
assertThat(user0).isNull();
}

private void littleSleep() {
private void littleSleep(int millis) {
try {
Thread.sleep(100);
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 4b26048

Please sign in to comment.