Skip to content

Port nimbus_test.clj from Clojure to Java (Phase 7)#8453

Merged
jnioche merged 5 commits intoapache:masterfrom
DigitalPebble:port/clojure-tests-phase7
Mar 30, 2026
Merged

Port nimbus_test.clj from Clojure to Java (Phase 7)#8453
jnioche merged 5 commits intoapache:masterfrom
DigitalPebble:port/clojure-tests-phase7

Conversation

@jnioche
Copy link
Copy Markdown
Contributor

@jnioche jnioche commented Mar 29, 2026

Summary

Port 39 tests from storm-core/test/clj/org/apache/storm/nimbus_test.clj to Java/JUnit 5 in storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusClojurePortTest.java.

Part of #8445 — removing the Clojure dependency from the Apache Storm build.

Tests ported (39 total, in 5 batches):

Batch 7a (13 tests): testBogusId, testNimbusIfaceSubmitTopologyWithOptsChecksAuthorization, testNimbusIfaceMethodsCheckAuthorization, testNimbusIfaceGetTopologyMethodsThrowCorrectly, testNimbusIfaceGetClusterInfoFiltersToposWithoutBases, testValidateTopoConfigOnSubmit, testDebugOnComponent, testDebugOnGlobal, emptySaveConfigResultsInAllUnchangedActions, logLevelUpdateMergesAndFlagsExistentLogLevel, cleanupStormIdsReturnsInactiveTopos, cleanupStormIdsPerformsUnionOfStormIdsWithActiveZnodes, cleanupStormIdsReturnsEmptySetWhenAllToposAreActive

Batch 7b (6 tests): doCleanupRemovesInactiveZnodes, doCleanupDoesNotTeardownActiveTopos, userTopologiesForSupervisor, userTopologiesForSupervisorWithUnauthorizedUser, testCleanInbox, testSubmitInvalid

Batch 7c (5 tests): testAssignment, testZeroExecutorOrTasks, testOverParallelismAssignment, testGetOwnerResourceSummaries, testAutoCredentials

Batch 7d (12 tests): testIsolatedAssignment, testExecutorAssignments, testTopoHistory, testKillStorm, testReassignment, testReassignmentToConstrainedCluster, testReassignSqueezedTopology, testRebalance, testRebalanceChangeParallelism, testRebalanceConstrainedCluster, testNimbusCheckAuthorizationParams, testCheckAuthorizationGetSupervisorPageInfo

Batch 7e (3 tests): testLeadership, testStatelessWithScheduledTopologyToBeKilled, testTopologyActionNotifier — these were previously skipped because direct Nimbus+ZooKeeper construction with static mocking (MockedZookeeper) caused JVM crashes. Ported by using real InProcessZookeeper and Mockito-based leader elector mocks instead.

Tests not ported (1):

  • test-file-bogus-download: beginFileDownload API has been removed from Nimbus

New helper files:

  • MockAutoCred.java — duplicated from storm-core test sources (not on storm-server classpath)
  • InMemoryTopologyActionNotifier.java — duplicated from storm-core test sources

Other improvements:

  • Replaced Thread.sleep with Awaitility in the waitForStatus helper

Test plan

  • All 39 tests pass: mvn test -pl storm-server -Dtest=NimbusClojurePortTest
  • Verify no regressions in full storm-server test suite

🤖 Generated with Claude Code

jnioche and others added 4 commits March 28, 2026 12:20
Port simple/unit-like Nimbus tests from
storm-core/test/clj/org/apache/storm/nimbus_test.clj to
storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusClojurePortTest.java.

Tests ported: testBogusId, testNimbusIfaceSubmitTopologyWithOptsChecksAuthorization,
testNimbusIfaceMethodsCheckAuthorization, testNimbusIfaceGetTopologyMethodsThrowCorrectly,
testNimbusIfaceGetClusterInfoFiltersToposWithoutBases, testValidateTopoConfigOnSubmit,
testDebugOnComponent, testDebugOnGlobal, emptySaveConfigResultsInAllUnchangedActions,
logLevelUpdateMergesAndFlagsExistentLogLevel, cleanupStormIdsReturnsInactiveTopos,
cleanupStormIdsPerformsUnionOfStormIdsWithActiveZnodes,
cleanupStormIdsReturnsEmptySetWhenAllToposAreActive.

Skipped test-file-bogus-download (beginFileDownload API removed from Java).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add batch 7b tests: doCleanupRemovesInactiveZnodes,
doCleanupDoesNotTeardownActiveTopos, userTopologiesForSupervisor,
userTopologiesForSupervisorWithUnauthorizedUser, testCleanInbox,
testSubmitInvalid.

Total: 19 of 40 Nimbus tests ported.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…to-credentials tests

Add 5 more tests from nimbus_test.clj:
- testAssignment: basic topology assignment verification
- testZeroExecutorOrTasks: validates zero executors/tasks handled correctly
- testOverParallelismAssignment: verifies over-parallelism assignment behavior
- testGetOwnerResourceSummaries: tests owner resource summary computation
- testAutoCredentials: tests credential plugin lifecycle (populate, renew)

Also adds MockAutoCred to storm-server test sources (duplicated from storm-core
since storm-server cannot depend on storm-core test classes) and helper methods:
fromJson, stormComponentToTaskInfo, stormNumWorkers, getCredentials, checkConsistency.

Total: 24 tests passing (13 batch 7a + 6 batch 7b + 5 batch 7c).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… authorization tests

Add 12 more tests from nimbus_test.clj:
- testIsolatedAssignment: isolation scheduler with per-topology node allocation
- testExecutorAssignments: executor-to-task distribution verification
- testTopoHistory: topology history with per-user/group visibility
- testKillStorm: full kill lifecycle with timeouts and kill options
- testReassignment: executor heartbeat timeout and reassignment behavior
- testReassignmentToConstrainedCluster: reassignment with limited resources
- testReassignSqueezedTopology: progressive cluster expansion and rebalancing
- testRebalance: basic rebalance across new supervisors
- testRebalanceChangeParallelism: rebalance with worker/executor changes
- testRebalanceConstrainedCluster: rebalance with port collision checks
- testNimbusCheckAuthorizationParams: authorization param verification
- testCheckAuthorizationGetSupervisorPageInfo: supervisor page auth checks

Also adds helper methods: topologyNodes, topologySlots, topologyNodeDistribution,
executorAssignment, executorStartTimes, topologyExecutors, slotAssignments,
doExecutorHeartbeat, checkDistribution, checkExecutorDistribution, checkNumNodes,
checkForCollisions, stormComponentToExecutorInfo, mkNimbus, waitForStatus.

Skipped tests (require direct Nimbus+ZK construction that causes JVM crashes):
- test-leadership, test-stateless-with-scheduled-topology-to-be-killed,
  test-topology-action-notifier
Also skipped test-file-bogus-download (beginFileDownload API removed).

Total: 36 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ion, and action notifier

Uses real InProcessZookeeper instead of MockedZookeeper static mocking,
avoiding the JVM crashes that previously prevented these tests from being ported.
Also replaces Thread.sleep with Awaitility in waitForStatus helper.

Part of apache#8445

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jnioche jnioche merged commit 855a72a into apache:master Mar 30, 2026
10 checks passed
@jnioche jnioche deleted the port/clojure-tests-phase7 branch March 30, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants