From 53a22b8a8a453690878deb4cffe20478d9e16a3b Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Mon, 28 Oct 2019 11:04:57 +0100 Subject: [PATCH] Fix Validity of RepositoryDataTests Randomness (#48564) (#48566) Trivial point, but we were only testing shard generations for a single shard here, accidentally, and not testing the `null` generation case at all. --- .../org/elasticsearch/repositories/RepositoryDataTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/repositories/RepositoryDataTests.java b/server/src/test/java/org/elasticsearch/repositories/RepositoryDataTests.java index f0923b98048..58a63226cd7 100644 --- a/server/src/test/java/org/elasticsearch/repositories/RepositoryDataTests.java +++ b/server/src/test/java/org/elasticsearch/repositories/RepositoryDataTests.java @@ -276,7 +276,8 @@ public class RepositoryDataTests extends ESTestCase { for (IndexId someIndex : someIndices) { final int shardCount = randomIntBetween(1, 10); for (int j = 0; j < shardCount; ++j) { - builder.put(someIndex, 0, UUIDs.randomBase64UUID(random())); + final String uuid = randomBoolean() ? null : UUIDs.randomBase64UUID(random()); + builder.put(someIndex, j, uuid); } } repositoryData = repositoryData.addSnapshot(snapshotId, randomFrom(SnapshotState.values()), builder.build());