Skip to content

fake consumer unsubscribes#388

Merged
rultor merged 1 commit into
masterfrom
fake-consumer
Jun 22, 2023
Merged

fake consumer unsubscribes#388
rultor merged 1 commit into
masterfrom
fake-consumer

Conversation

@h1alexbel

@h1alexbel h1alexbel commented Jun 21, 2023

Copy link
Copy Markdown
Member

@l3r8yJ take a look, please

closes #371 #297

PR-Codex overview

This PR implements the unsubscribe() method for the FkConsumer class in the io.github.eocqrs.kafka.fake package.

Detailed summary

  • Adds unsubscribe() method to FkConsumer class.
  • Implements UnsubscribeDirs class to handle the unsubscribe() method.
  • Adds tests for unsubscribe() method and UnsubscribeDirs class.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@zoeself

zoeself commented Jun 21, 2023

Copy link
Copy Markdown
Collaborator

@h1alexbel thank you for your Pull Request. I'll assign someone to review it soon.

If this PR solves a todo from the code, please don't forget to remove it.

@codecov

codecov Bot commented Jun 21, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (1810a74) 97.79% compared to head (fd4c990) 97.86%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #388      +/-   ##
============================================
+ Coverage     97.79%   97.86%   +0.06%     
- Complexity      154      157       +3     
============================================
  Files            72       73       +1     
  Lines           408      421      +13     
  Branches          0        1       +1     
============================================
+ Hits            399      412      +13     
  Misses            9        9              
Impacted Files Coverage Δ
...n/java/io/github/eocqrs/kafka/fake/FkConsumer.java 100.00% <100.00%> (ø)
...a/io/github/eocqrs/kafka/fake/UnsubscribeDirs.java 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zoeself

zoeself commented Jun 21, 2023

Copy link
Copy Markdown
Collaborator

@l3r8yJ please review this Pull Request. Deadline (when it should be merged or closed) is 2023-06-24T13:09:04.288253.

You should check if the requirements have been implemented (partially or in full), if there are unit tests covering the changes and if the CI build passes. Feel free to reject the PR or ask for changes if it's too big or not clear enough.

Estimation here is 30 minutes, that's how much you will be paid. You will be paid even if this PR gets rejected.

@h1alexbel h1alexbel requested a review from l3r8yJ June 21, 2023 13:12

@l3r8yJ l3r8yJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@h1alexbel wdyt

Comment on lines 244 to +253

@Test
void unsubscribes() throws Exception {
final String topic = "unsubscribe.test";
final UUID uuid = UUID.randomUUID();
final Consumer<String, String> consumer =
new FkConsumer<>(
uuid,
this.broker
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
@Test
void unsubscribes() throws Exception {
final String topic = "unsubscribe.test";
final UUID uuid = UUID.randomUUID();
final Consumer<String, String> consumer =
new FkConsumer<>(
uuid,
this.broker
);
@Test
@ExtendWith({
UUIDExtension.class,
ConsumerExtension.class
})
void unsubscribes(final UUID uuid, final Consumer<String, String> consumer) throws Exception {
final String topic = "unsubscribe.test";

@h1alexbel h1alexbel Jun 22, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@l3r8yJ Unfortunately it is not possible to mix the params using extensions

if we need a UUIDExtension and ConsumerExtension:

when creating a consumer, we need a UUID from the extension, that generates it
but I can't take this generated parameter

Then, if we decide to make only one ConsumerExtension, in following assertion we don't have parameter uuid:

MatcherAssert.assertThat(
      "Consumer ID in subscription is not present",
      this.broker.data(
          "broker/subs/sub[consumer = '%s']/consumer/text()"
            .formatted(
              uuid
            )
        )
        .isEmpty(),
      Matchers.equalTo(true)
    );

maybe I missing something, especially in getting parameters from another extension

WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@l3r8yJ also, this test case (unsubscribes) requires testing consumers with the same broker

@h1alexbel h1alexbel requested a review from l3r8yJ June 22, 2023 09:02

@l3r8yJ l3r8yJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@h1alexbel and yes, you're right, we can't do it with those parameters

@h1alexbel

Copy link
Copy Markdown
Member Author

@rultor merge

@rultor

rultor commented Jun 22, 2023

Copy link
Copy Markdown
Collaborator

@rultor merge

@h1alexbel OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit d565454 into master Jun 22, 2023
@rultor

rultor commented Jun 22, 2023

Copy link
Copy Markdown
Collaborator

@rultor merge

@h1alexbel Done! FYI, the full log is here (took me 3min)

@zoeself

zoeself commented Jun 22, 2023

Copy link
Copy Markdown
Collaborator

@l3r8yJ thank you for resolving this ticket. I've just added it to your active invoice. You can always check all your invoices and more on the Contributor Dashboard.

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.

deletion of fake topic subscription is not implemented FkConsumer.java:75: Fake unsubscribe is not implemented

4 participants