Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding eventbus/base/kafka tests #2750

Closed
wants to merge 3 commits into from

Conversation

zhaque44
Copy link
Contributor

Adding tests for eventbus/base/kafka.go:

func TestBrokers

The Brokers method basically splits the comma-separated broker URLs and return them as a slice of strings.

In the test:

A sample eventbusv1alpha1.KafkaBus configuration is created with two broker URLs: "broker1:9092" and "broker2:9092".
Then the Brokers method of the created kafka instance is called to get the actual list of broker addresses. This test will ensure that the Brokers method correctly parses the comma-separated broker URLs and returns them as a list of strings.

func TestConfig

This test is verifying the behavior of the Config func in the context of the Kafka struct. The Config func is responsible for generating a sarama.Config instance with specific configuration settings based on the KafkaBus configuration. It's validating that the logic for translating the higher-level configuration to the lower-level Kafka client library's configuration is working.

func TestConfig_NoSASL

This test is checking the behavior when SASL configuration is not provided, by setting SASL to nil.

func TestNewKafka

This test validates the NewKafka func, which initializes a kafka object with a given configuration and logger. It ensures that the kafka object and its logger are properly initialized.

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
@zhaque44
Copy link
Contributor Author

@whynowy Hi, can you please review this PR & take a look

@zhaque44
Copy link
Contributor Author

zhaque44 commented Sep 7, 2023

@whynowy can I have a review please, this PR is ready to go. I merged master into the branch as well

@zhaque44 zhaque44 closed this Sep 18, 2023
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.

1 participant