diff --git a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index 5cd03335dd964..80c0a010e5de3 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -157,6 +157,13 @@ protected Collection> nodePlugins() { MockRepository.Plugin.class); } + @Override + protected Settings nodeSettings(int nodeOrdinal) { + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) + .put(ThreadPool.ESTIMATED_TIME_INTERVAL_SETTING.getKey(), 0) // We have tests that check by-timestamp order + .build(); + } + private Settings randomRepoSettings() { Settings.Builder repoSettings = Settings.builder(); repoSettings.put("location", randomRepoPath()); @@ -1340,8 +1347,7 @@ public void testGetSnapshotsNoRepos() { assertTrue(getSnapshotsResponse.getSuccessfulResponses().isEmpty()); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/43993") - public void testGetSnapshotsMultipleRepos() { + public void testGetSnapshotsMultipleRepos() throws Exception { final Client client = client(); List snapshotList = new ArrayList<>(); @@ -1370,6 +1376,11 @@ public void testGetSnapshotsMultipleRepos() { for (int snapshotIndex = 0; snapshotIndex < randomIntBetween(2, 5); snapshotIndex++) { final String snapshotName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); snapshotList.add(snapshotName); + // Wait for at least 1ms to ensure that snapshots can be ordered by timestamp deterministically + for (final ThreadPool threadPool : internalCluster().getInstances(ThreadPool.class)) { + final long startMillis = threadPool.absoluteTimeInMillis(); + assertBusy(() -> assertThat(threadPool.absoluteTimeInMillis(), greaterThan(startMillis))); + } logger.info("--> create snapshot with index {} and name {} in repository {}", snapshotIndex, snapshotName, repoName); CreateSnapshotResponse createSnapshotResponse = client.admin() .cluster()