xiangfu0 opened a new pull request, #20236: URL: https://github.com/apache/pinot/pull/20236
`testTableLevelHybridRetentionStrategyOverridesClusterConfig` (added in #20116) builds its manager through `createSizeRetentionManager(...)`, which goes through the overridable `createRetentionManager(...)` factory, and then spies it to stub and verify the package-private `manageRetentionForHybridTable` and `manageRetentionForRealtimeTable`. When a suite that extends `RetentionManagerTest` overrides the factory to return a `RetentionManager` subclass from another package, Mockito can't intercept those package-private methods on the spy. The real `manageRetentionForHybridTable` then runs and every data-provider case fails with `NullPointerException: Cannot invoke "TableConfig.getTableName()" because "realtimeTableConfig" is null`. This is the same pattern #20119 fixed for the hybrid retention override tests, and the fix is the same: stub the resource manager with `stubSizeRetentionResourceManager(...)` and spy a plain `new RetentionManager(...)`, as `createRetentionManagerWithHybridRetentionOverride` already does. The test still covers the same strategy selection logic. It just no longer depends on which subclass the factory returns. Test-only change. Testing: `RetentionManagerTest` passes (71 tests). I also checked it locally with a throwaway suite that extends `RetentionManagerTest` from a different package and overrides `createRetentionManager` to return a subclass. Before this change all 12 cases of this test fail with the NPE above, and after it the whole inherited suite passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
