Skip to content

Consolidate query killing integration tests into single class#18300

Merged
mayankshriv merged 1 commit into
apache:masterfrom
mayankshriv:integ-tests-cleanup
Apr 24, 2026
Merged

Consolidate query killing integration tests into single class#18300
mayankshriv merged 1 commit into
apache:masterfrom
mayankshriv:integ-tests-cleanup

Conversation

@mayankshriv
Copy link
Copy Markdown
Contributor

Summary

  • Merges 3 child test classes (CpuBasedBrokerQueryKillingIntegrationTest, CpuBasedServerQueryKillingIntegrationTest, MemoryBasedServerQueryKillingIntegrationTest) and their abstract base into one concrete QueryKillingIntegrationTest
  • Eliminates 2 redundant full cluster starts (ZK + Controller + Broker + Server) by using a single shared cluster with dynamic config switching per test method
  • Each test method enables its specific kill mode via updateClusterConfig(), runs assertions, then resets configs in a finally block
  • A superset of static startup configs (CPU + memory sampling on both broker and server) enables all kill modes to be toggled at runtime

Net result: -115 lines, 3 cluster starts → 1 cluster start (~1-3 min wall-clock savings)

Test plan

  • ./mvnw -pl pinot-integration-tests -Dtest=QueryKillingIntegrationTest test — all 5 tests pass (resource stats, CPU broker kill, CPU server kill, memory server kill, resource stats after killing)
  • testResourceUsageStatsAfterKilling verifies the accountant is not degraded after OOM kills
  • Pre-commit checks pass (spotless, checkstyle, license)

🤖 Generated with Claude Code

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.63%. Comparing base (81732e0) to head (a713ab2).
⚠️ Report is 21 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18300      +/-   ##
============================================
- Coverage     63.65%   63.63%   -0.03%     
  Complexity     1659     1659              
============================================
  Files          3244     3246       +2     
  Lines        197390   197512     +122     
  Branches      30555    30578      +23     
============================================
+ Hits         125646   125677      +31     
- Misses        61690    61800     +110     
+ Partials      10054    10035      -19     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.60% <ø> (+0.04%) ⬆️
java-21 63.59% <ø> (-0.04%) ⬇️
temurin 63.63% <ø> (-0.03%) ⬇️
unittests 63.62% <ø> (-0.03%) ⬇️
unittests1 55.60% <ø> (+0.04%) ⬆️
unittests2 35.05% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@noob-se7en noob-se7en added testing Related to tests or test infrastructure refactor Code restructuring without changing behavior labels Apr 23, 2026
@Test(priority = 1)
public void testCpuBasedBrokerQueryKilling()
throws Exception {
updateClusterConfig(Map.of(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these cluster configs being updated for each test behind PinotClusterConfigChangeListener?
As prev test might be written because of components requiring restarts for configs to kick in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WatcherTask inner class implements PinotClusterConfigChangeListener, which makes these dynamic?

Accounting.BROKER_PREFIX + "." + Accounting.Keys.CRITICAL_LEVEL_HEAP_USAGE_RATIO, "1.1",
Accounting.BROKER_PREFIX + "." + Accounting.Keys.PANIC_LEVEL_HEAP_USAGE_RATIO, "1.1"
));
Thread.sleep(5000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This eliminates the purpose of reducing the test time. We should do a timed check of QueryMonitorConfig

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, done.

@mayankshriv mayankshriv force-pushed the integ-tests-cleanup branch from 2ddbff1 to 5b9b277 Compare April 23, 2026 17:25
// Helpers
// ---------------------------------------------------------------------------

private void resetAccountingConfigs()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slows down the test. Given we control the order of the test, let's not reset the config, but only moving forward

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- Merge CPU broker, CPU server, and OOM server killing tests into one shared cluster
- Use forward-only config progression (no full reset between tests)
- Add testDefaultValues to verify accountant defaults after startup
- Add testDynamicallyToggleQueryKill to verify dynamic config toggling
- Use dependsOnMethods for explicit test ordering and skip-on-failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mayankshriv mayankshriv force-pushed the integ-tests-cleanup branch from 5b9b277 to a713ab2 Compare April 23, 2026 23:53
@mayankshriv mayankshriv merged commit dc1b3bd into apache:master Apr 24, 2026
16 checks passed
@mayankshriv mayankshriv deleted the integ-tests-cleanup branch April 24, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without changing behavior testing Related to tests or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants