Skip to content

Commit 7d0aff0

Browse files
author
Hendrik Muhs
committed
[ML-DataFrame] fix test failure in checkpoint retrieval (#45297)
gracefully handle if index response returns null, increase and assert timeout closes #45238
1 parent a501d68 commit 7d0aff0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/checkpoint/DefaultCheckpointProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ protected void getIndexCheckpoints (ActionListener<Map<String, long[]>> listener
148148

149149
ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), ClientHelper.DATA_FRAME_ORIGIN, client, GetIndexAction.INSTANCE,
150150
getIndexRequest, ActionListener.wrap(getIndexResponse -> {
151-
Set<String> userIndices = new HashSet<>(Arrays.asList(getIndexResponse.getIndices()));
151+
Set<String> userIndices = getIndexResponse.getIndices() != null
152+
? new HashSet<>(Arrays.asList(getIndexResponse.getIndices()))
153+
: Collections.emptySet();
152154
// 2nd get stats request
153155
ClientHelper.executeAsyncWithOrigin(client,
154156
ClientHelper.DATA_FRAME_ORIGIN,

x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/DataFrameSingleNodeTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected <T> void assertAsync(Consumer<ActionListener<T>> function, T expected,
7070
}), latch);
7171

7272
function.accept(listener);
73-
latch.await(10, TimeUnit.SECONDS);
73+
assertTrue("timed out after 20s", latch.await(20, TimeUnit.SECONDS));
7474
}
7575

7676
}

x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/checkpoint/DataFrameTransformCheckpointServiceNodeTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public class DataFrameTransformCheckpointServiceNodeTests extends DataFrameSingl
7373

7474
private class MockClientForCheckpointing extends NoOpClient {
7575

76-
private ShardStats[] shardStats;
77-
private String[] indices;
76+
private volatile ShardStats[] shardStats;
77+
private volatile String[] indices;
7878

7979
MockClientForCheckpointing(String testName) {
8080
super(testName);
@@ -98,6 +98,7 @@ void doExecute(ActionType<Response> action, Request request, ActionListener<Resp
9898

9999
if (request instanceof GetIndexRequest) {
100100
// for this test we only need the indices
101+
assert(indices != null);
101102
final GetIndexResponse indexResponse = new GetIndexResponse(indices, null, null, null, null);
102103

103104
listener.onResponse((Response) indexResponse);

0 commit comments

Comments
 (0)