Skip to content

Commit

Permalink
Adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
droberts195 committed Dec 19, 2023
1 parent 1aa8814 commit 4bf1031
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.Quantiles;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.TimingStats;
import org.elasticsearch.xpack.core.ml.job.results.Result;
import org.elasticsearch.xpack.core.ml.utils.MlIndexAndAlias;
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
import org.elasticsearch.xpack.ml.MlSingleNodeTestCase;
Expand Down Expand Up @@ -846,6 +847,16 @@ public void testGetSnapshots() {
assertNull(snapshots.get(3).getQuantiles());
assertNull(snapshots.get(4).getQuantiles());

// test get single snapshot
PlainActionFuture<Result<ModelSnapshot>> singleFuture = new PlainActionFuture<>();
jobProvider.getModelSnapshot(jobId, "snap_1", true, singleFuture::onResponse, singleFuture::onFailure);
ModelSnapshot withQuantiles = singleFuture.actionGet().result;
assertThat(withQuantiles.getQuantiles().getTimestamp().getTime(), equalTo(11L));

singleFuture = new PlainActionFuture<>();
jobProvider.getModelSnapshot(jobId, "snap_2", false, singleFuture::onResponse, singleFuture::onFailure);
ModelSnapshot withoutQuantiles = singleFuture.actionGet().result;
assertNull(withoutQuantiles.getQuantiles());
}

public void testGetAutodetectParams() throws Exception {
Expand Down

0 comments on commit 4bf1031

Please sign in to comment.