[Transform] fix sporadic race condition in TransformUsageIT (#52946)
relax the test for trigger count fixes #52931
This commit is contained in:
parent
a154f9c657
commit
d9258e210e
|
@ -22,6 +22,8 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.elasticsearch.xpack.core.transform.TransformField.INDEX_DOC_TYPE;
|
import static org.elasticsearch.xpack.core.transform.TransformField.INDEX_DOC_TYPE;
|
||||||
import static org.elasticsearch.xpack.transform.TransformFeatureSet.PROVIDED_STATS;
|
import static org.elasticsearch.xpack.transform.TransformFeatureSet.PROVIDED_STATS;
|
||||||
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
|
||||||
public class TransformUsageIT extends TransformRestTestCase {
|
public class TransformUsageIT extends TransformRestTestCase {
|
||||||
|
|
||||||
|
@ -102,12 +104,21 @@ public class TransformUsageIT extends TransformRestTestCase {
|
||||||
|| statName.equals(TransformIndexerStats.SEARCH_TIME_IN_MS.getPreferredName())) {
|
|| statName.equals(TransformIndexerStats.SEARCH_TIME_IN_MS.getPreferredName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assertEquals(
|
|
||||||
|
// the trigger count can be higher if the scheduler kicked before usage has been called, therefore check for gte
|
||||||
|
if (statName.equals(TransformIndexerStats.NUM_INVOCATIONS.getPreferredName())) {
|
||||||
|
assertThat(
|
||||||
"Incorrect stat " + statName,
|
"Incorrect stat " + statName,
|
||||||
expectedStats.get(statName).doubleValue(),
|
|
||||||
extractStatsAsDouble(XContentMapValues.extractValue("transform.stats." + statName, statsMap)),
|
extractStatsAsDouble(XContentMapValues.extractValue("transform.stats." + statName, statsMap)),
|
||||||
0.0001
|
greaterThanOrEqualTo(expectedStats.get(statName).doubleValue())
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
assertThat(
|
||||||
|
"Incorrect stat " + statName,
|
||||||
|
extractStatsAsDouble(XContentMapValues.extractValue("transform.stats." + statName, statsMap)),
|
||||||
|
equalTo(expectedStats.get(statName).doubleValue())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Refresh the index so that statistics are searchable
|
// Refresh the index so that statistics are searchable
|
||||||
refreshIndex(TransformInternalIndexConstants.LATEST_INDEX_VERSIONED_NAME);
|
refreshIndex(TransformInternalIndexConstants.LATEST_INDEX_VERSIONED_NAME);
|
||||||
|
|
Loading…
Reference in New Issue