Skip to content

KAFKA-20388: Move LogConfigTest from core to storage #21980

Open
see-quick wants to merge 1 commit intoapache:trunkfrom
see-quick:KAFKA-20388
Open

KAFKA-20388: Move LogConfigTest from core to storage #21980
see-quick wants to merge 1 commit intoapache:trunkfrom
see-quick:KAFKA-20388

Conversation

@see-quick
Copy link
Copy Markdown
Contributor

This is another PR migrating Log* test classes into storage module (from core).
I have migrate this but also did a bit refactoring ... where I though it would remove a bit of redudant code (i.e., I have created a helper method for KafkaConfig). Also improved a bit testFromPropsInvalid where there were two branches pointing on the same values so I merged those. And also I had problem with testFromPropsInvalid where it had CyclomaticComplexity so I re-write it into more cleaner approach just extracting the switch into helper method.

Signed-off-by: see-quick <maros.orsak159@gmail.com>
@github-actions github-actions bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) storage Pull requests that target the storage module labels Apr 7, 2026
Copy link
Copy Markdown
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

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

Thanks for the patch. Left some comments. And if we still rely on Scala KafkaConfig, it may not be the right time to move this test.

Comment on lines +338 to +339
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, "true");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, "true");
Map<String, String> logProps = Map.of(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, "true");

Comment on lines +412 to +414
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, String.valueOf(sysRemoteStorageEnabled));
logProps.put(TopicConfig.RETENTION_BYTES_CONFIG, "128");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, String.valueOf(sysRemoteStorageEnabled));
logProps.put(TopicConfig.RETENTION_BYTES_CONFIG, "128");
Map<String, String> logProps = Map.of(
TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, String.valueOf(sysRemoteStorageEnabled),
TopicConfig.RETENTION_MS_CONFIG, "500"
);

Comment on lines +448 to +449
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_COPY_DISABLE_CONFIG, String.valueOf(copyDisabled));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_COPY_DISABLE_CONFIG, String.valueOf(copyDisabled));
Map<String, String> logProps = Map.of(TopicConfig.REMOTE_LOG_COPY_DISABLE_CONFIG, String.valueOf(copyDisabled));

Comment on lines +456 to +457
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_DELETE_ON_DISABLE_CONFIG, String.valueOf(deleteOnDisable));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
HashMap<String, String> logProps = new HashMap<>();
logProps.put(TopicConfig.REMOTE_LOG_DELETE_ON_DISABLE_CONFIG, String.valueOf(deleteOnDisable));
Map<String, String> logProps = Map.of(TopicConfig.REMOTE_LOG_DELETE_ON_DISABLE_CONFIG, String.valueOf(deleteOnDisable));

}

private KafkaConfig createKafkaConfig(boolean remoteStorageEnabled, Properties extra) {
Properties props = TestUtils.createDummyBrokerConfig();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Java tests should avoid to depend on Scala TestUtils.

@github-actions github-actions bot removed the triage PRs from the community label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved core Kafka Broker storage Pull requests that target the storage module tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants