@ParameterizedTest
    @ValueSource(booleans = {false, true})
    public void testFailingOverIncrementsNewActiveControllerCount(
        boolean forceFailoverUsingLogLayer
    ) throws Throwable {
        try (
            LocalLogManagerTestEnv logEnv = new LocalLogManagerTestEnv.Builder(3).
                build();
            QuorumControllerTestEnv controlEnv = new QuorumControllerTestEnv.Builder(logEnv).
                build()
        ) {
            registerBrokersAndUnfence(controlEnv.activeController(), 1); // wait for a controller to become active.
            TestUtils.retryOnExceptionWithTimeout(30_000, () -> {
                for (QuorumController controller : controlEnv.controllers()) {
                    assertEquals(1, controller.controllerMetrics().newActiveControllers());
                }
            });
            if (forceFailoverUsingLogLayer) {
                controlEnv.activeController().setNewNextWriteOffset(123L);

                TestUtils.retryOnExceptionWithTimeout(30_000, () ->
                    createTopics(controlEnv.activeController(), "test_", 1, 1)
                );
            } else {
                // Directly call QuorumController.renounce.
                forceRenounce(controlEnv.activeController());
            }
            TestUtils.retryOnExceptionWithTimeout(30_000, () -> {
                for (QuorumController controller : controlEnv.controllers()) {
                    assertEquals(2, controller.controllerMetrics().newActiveControllers());
                }
            });
        }
    }
Test that failing over to a new controller increments NewActiveControllersCount on both the
active and inactive controllers.
metadata/src/test/java/org/apache/kafka/controller/QuorumControllerMetricsIntegrationTest.java