mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-21 05:11:25 +00:00
Test: Fix DtoQueryPlanCaptureTest by draining plans
This commit is contained in:
@@ -72,10 +72,22 @@ class DtoQueryPlanCaptureTest extends BaseTestCase {
|
||||
.findList();
|
||||
}
|
||||
|
||||
private void drainCapturedPlans() {
|
||||
QueryPlanRequest drain = new QueryPlanRequest();
|
||||
drain.maxCount(100_000);
|
||||
drain.maxTimeMillis(30_000);
|
||||
DB.getDefault().metaInfo().queryPlanCollectNow(drain);
|
||||
}
|
||||
|
||||
@Test
|
||||
void nativeDtoQuery_capturesQueryPlan() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
// drain any query plans captured by earlier tests in the suite, otherwise the
|
||||
// shared (process-global) capture map can exhaust the collect budget below before
|
||||
// our plan is reached (order dependent, and slow to capture on Oracle).
|
||||
drainCapturedPlans();
|
||||
|
||||
// build the plans first (default threshold -> no capture yet)
|
||||
assertThat(runNative()).isNotEmpty();
|
||||
runOrmBacked();
|
||||
@@ -118,6 +130,9 @@ class DtoQueryPlanCaptureTest extends BaseTestCase {
|
||||
void nativeDtoQuery_withProfileLocation_capturesQueryPlan() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
// drain stale captures first (see nativeDtoQuery_capturesQueryPlan)
|
||||
drainCapturedPlans();
|
||||
|
||||
// build the plan first (default threshold -> no capture yet)
|
||||
assertThat(runNativeWithLocation()).isNotEmpty();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user