Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static io.unitycatalog.server.utils.TestUtils.SCHEMA_NAME2;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.fail;

import io.unitycatalog.client.ApiException;
import io.unitycatalog.client.model.CreateCatalog;
Expand All @@ -37,6 +38,7 @@
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -381,10 +383,15 @@ public void testModelCRUD() throws ApiException {

/**
* Returns once the clock is past {@code millis}. The server sets updated_at from the same clock,
* so an update sent next gets a later timestamp instead of one in the same millisecond.
* so an update sent next gets a later timestamp instead of one in the same millisecond. Fails
* after 5 seconds, for a wall clock that stepped backwards.
*/
private static void waitForClockToPass(long millis) {
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
while (System.currentTimeMillis() <= millis) {
if (System.nanoTime() > deadline) {
fail("The clock did not pass %d within 5 seconds", millis);
}
Thread.onSpinWait();
}
}
Expand Down
Loading