Skip to content

Support Kafka topic auto creation config - #104

Merged
zmstone merged 3 commits into
mainfrom
251028-support-kafka-topic-auto-creation
Oct 30, 2025
Merged

Support Kafka topic auto creation config#104
zmstone merged 3 commits into
mainfrom
251028-support-kafka-topic-auto-creation

Conversation

@zmstone

@zmstone zmstone commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

Previously allow_auto_topic_creation for metadata request is hard-coded to false.
This PR makes it configurable.

@zmstone
zmstone force-pushed the 251028-support-kafka-topic-auto-creation branch from 4b0a15b to b471385 Compare October 29, 2025 21:05
Comment thread src/wolff_client.erl
Req = kpro_req_lib:metadata(Vsn, [Topic], _IsAutoCreateAllowed = false),
-spec retry(fun(() -> {ok, term()} | {error, term()}), timeout()) -> {ok, term()} | {error, term()}.
retry(Fun, Timeout) ->
Deadline = erlang:monotonic_time(millisecond) + Timeout,

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.

If Timeout :: timeout(), then we must check if Timeout = infinity before adding.

Comment thread test/wolff_client_SUITE.erl Outdated
wolff_client:recv_leader_connection(Client, ?NO_GROUP, Topic, 0, self(), ?all_partitions),
receive
{leader_connection, Pid} when is_pid(Pid) ->
?assert(is_pid(Pid));

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.

Nit: already asserted by guard.

Comment thread test/wolff_client_SUITE.erl Outdated
Comment on lines +160 to +164
%% Helper function to create a mock connection for testing
mock_connection() ->
%% Create a mock connection that can be used in tests
%% This is a simplified mock - in real tests you might want to use a more sophisticated mock
{mock_connection, self()}.

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.

Unused?

Comment thread test/wolff_client_SUITE.erl Outdated
Comment on lines +150 to +158
%% Helper function for meck mocking (similar to pattern used in other test files)
with_meck(Mod, FnName, MockedFn, Action) ->
ok = meck:new(Mod, [non_strict, no_history, no_link, passthrough]),
ok = meck:expect(Mod, FnName, MockedFn),
try
Action()
after
meck:unload(Mod)
end.

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.

unused?

@zmstone
zmstone merged commit fcb9876 into main Oct 30, 2025
4 checks passed
@zmstone
zmstone deleted the 251028-support-kafka-topic-auto-creation branch October 30, 2025 14:36
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.

3 participants