Skip to content

Commit

Permalink
[ML] Fix DataFrameAnalyticsConfigProviderIT.testUpdate_UpdateCannotBe…
Browse files Browse the repository at this point in the history
…AppliedWhenTaskIsRunning

The test failed 1 in 32 times because if the value used in the update
matched the random value used in the original config created by
DataFrameAnalyticsConfigTests.createRandom then the update would be
a no-op and no exception would be thrown.

Fixes elastic#58814
  • Loading branch information
droberts195 committed Feb 22, 2024
1 parent 8fd6e30 commit 5bd33cc
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ public void testUpdate_ConfigDoesNotExist() throws InterruptedException {
assertThat(exceptionHolder.get(), is(instanceOf(ResourceNotFoundException.class)));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/58814")
public void testUpdate_UpdateCannotBeAppliedWhenTaskIsRunning() throws InterruptedException {
String configId = "config-id";
DataFrameAnalyticsConfig initialConfig = DataFrameAnalyticsConfigTests.createRandom(configId);
Expand All @@ -354,8 +353,10 @@ public void testUpdate_UpdateCannotBeAppliedWhenTaskIsRunning() throws Interrupt
AtomicReference<DataFrameAnalyticsConfig> updatedConfigHolder = new AtomicReference<>();
AtomicReference<Exception> exceptionHolder = new AtomicReference<>();

// Important: the new value specified here must be one that it's impossible for DataFrameAnalyticsConfigTests.createRandom
// to have used originally. If the update is a no-op then the test fails.
DataFrameAnalyticsConfigUpdate configUpdate = new DataFrameAnalyticsConfigUpdate.Builder(configId).setModelMemoryLimit(
ByteSizeValue.ofMb(2048)
ByteSizeValue.ofMb(1234)
).build();

ClusterState clusterState = clusterStateWithRunningAnalyticsTask(configId, DataFrameAnalyticsState.ANALYZING);
Expand Down

0 comments on commit 5bd33cc

Please sign in to comment.