Skip to content

[fix][test] Fix flaky test ExtensibleLoadManagerTest.testIsolationPolicy#20609

Merged
lhotari merged 3 commits into
apache:masterfrom
lhotari:lh-fix-flaky-ExtensibleLoadManagerTest.testIsolationPolicy
Jun 20, 2023
Merged

[fix][test] Fix flaky test ExtensibleLoadManagerTest.testIsolationPolicy#20609
lhotari merged 3 commits into
apache:masterfrom
lhotari:lh-fix-flaky-ExtensibleLoadManagerTest.testIsolationPolicy

Conversation

@lhotari

@lhotari lhotari commented Jun 19, 2023

Copy link
Copy Markdown
Member

Fixes #20608

Motivation

ExtensibleLoadManagerTest.testIsolationPolicy is flaky

Modifications

  • make condition match what the error is in the flaky case
  • cleanup admin client resources

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@lhotari lhotari self-assigned this Jun 19, 2023
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Jun 19, 2023

@tisonkun tisonkun 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.

Can you provide a bit of details about why we should match this extra pattern? I suppose it is what the failure test throws but it can be either the test is wrong or the implementation is wrong.

One nit style comment inline.

} catch (Exception ex) {
log.error("Failed to lookup topic: ", ex);
assertTrue(ex.getMessage().contains("Failed to look up a broker"));
assertTrue(ex.getMessage().contains("Failed to look up a 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.

Perhaps you can try to use assertj to assert contains so that we know the message instead of "expect true, actual false".

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.

Makes sense. I didn't realize that we already have AssertJ as a dependency since it's rarely used in the Pulsar code base.

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.

@tisonkun I switched to use AssertJ. However, there was a need to upgrade the AssertJ version since .containsAnyOf wasn't available in the version that was used. That is available since AssertJ 3.21.0, we were using 3.18.1 . I upgraded to latest AssertJ version which is 3.24.2 .

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.

Thank you! I'm not faimilar with this code so I cannot give an approval without more details. But @BewareMyPower already approves so it can be fine, with his endorsement :D

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.

Yeah, it LGTM.

@lhotari lhotari requested a review from tisonkun June 19, 2023 15:05
@lhotari

lhotari commented Jun 19, 2023

Copy link
Copy Markdown
Member Author

Can you provide a bit of details about why we should match this extra pattern? I suppose it is what the failure test throws but it can be either the test is wrong or the implementation is wrong.

@tisonkun This test is failing in very many cases so this is really flaky and blocking CI.
I expect @Demogorgon314 and @heesung-sn could answer your question.

} catch (Exception ex) {
log.error("Failed to lookup topic: ", ex);
assertTrue(ex.getMessage().contains("Failed to look up a broker"));
assertThat(ex.getMessage()).containsAnyOf("Failed to look up a 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.

I think it should always fail as "Failed to select the new owner broker for bundle".

@codecov-commenter

codecov-commenter commented Jun 20, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.07%. Comparing base (9bddd72) to head (677abc9).
Report is 1226 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #20609       +/-   ##
=============================================
+ Coverage     31.87%   73.07%   +41.19%     
- Complexity    11759    32010    +20251     
=============================================
  Files          1498     1867      +369     
  Lines        114593   138660    +24067     
  Branches      12425    15237     +2812     
=============================================
+ Hits          36532   101323    +64791     
+ Misses        73215    29318    -43897     
- Partials       4846     8019     +3173     
Flag Coverage Δ
inttests 24.14% <ø> (?)
systests 24.91% <ø> (?)
unittests 72.36% <ø> (+40.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1554 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: ExtensibleLoadManagerTest.testIsolationPolicy

8 participants