Skip to content

Commit f56de52

Browse files
authored
ESQL: Fix unlikely error in suggested cast tests (#127567)
The suggested casts tests would error out less than one percent of the time because they tried to suggest a cast for `unsupported` and expected `keyword`. That'll always be null. Caught this in an unreleated PR.
1 parent 465ef17 commit f56de52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/type/EsqlDataTypeConverterTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void testSuggestedCast() {
199199
Set<DataType> typesToTest = new HashSet<>(Set.of(DATETIME, DATE_NANOS));
200200
assertEquals(DATE_NANOS, DataType.suggestedCast(typesToTest));
201201

202-
DataType randomType = DataType.values()[random().nextInt(DataType.values().length)];
202+
DataType randomType = randomValueOtherThan(UNSUPPORTED, () -> randomFrom(DataType.values()));
203203
typesToTest.add(randomType);
204204
DataType suggested = DataType.suggestedCast(typesToTest);
205205
if (randomType != DATETIME && randomType != DATE_NANOS) {

0 commit comments

Comments
 (0)