You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/21 03:18:48 UTC
[GitHub] [pulsar] Technoboy- opened a new pull request, #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Technoboy- opened a new pull request, #18147:
URL: https://github.com/apache/pulsar/pull/18147
### Motivation
Based on #https://github.com/apache/pulsar/pull/18146
https://github.com/apache/pulsar/actions/runs/3281165538/jobs/5414499054
```
Error: Tests run: 161, Failures: 48, Errors: 0, Skipped: 50, Time elapsed: 48.407 s <<< FAILURE! - in org.apache.bookkeeper.mledger.impl.ManagedLedgerTest
Error: testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers(org.apache.bookkeeper.mledger.impl.ManagedLedgerTest) Time elapsed: 0.196 s <<< FAILURE!
org.mockito.exceptions.verification.TooManyActualInvocations:
nullLedgerOffloader.getOffloadPolicies();
Wanted 1 time:
-> at org.apache.bookkeeper.mledger.impl.NullLedgerOffloader.getOffloadPolicies(NullLedgerOffloader.java:66)
But was 2 times:
-> at org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.internalTrimLedgers(ManagedLedgerImpl.java:2473)
-> at org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.maybeOffload(ManagedLedgerImpl.java:2388)
```
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- commented on pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#issuecomment-1291666904
> @Technoboy- Looks like the test still get failed.
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1003157880
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3645,7 +3648,11 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, atLeastOnce()).getOffloadPolicies();
+ verify(finalLedgerOffloader, atMost(2)).getOffloadPolicies();
Review Comment:
added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- closed pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- closed pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
URL: https://github.com/apache/pulsar/pull/18147
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1002650483
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3624,6 +3624,8 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
LedgerOffloader ledgerOffloader = mock(NullLedgerOffloader.class);
OffloadPoliciesImpl offloadPolicies = mock(OffloadPoliciesImpl.class);
when(ledgerOffloader.getOffloadPolicies()).thenReturn(offloadPolicies);
+ when(ledgerOffloader.offload(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(null));
+ when(ledgerOffloader.getOffloadPolicies().getManagedLedgerOffloadThresholdInBytes()).thenReturn(-1L);
Review Comment:
I see the test don't sync invoke method offload, so it don't influence the test result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codecov-commenter commented on pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#issuecomment-1286467993
# [Codecov](https://codecov.io/gh/apache/pulsar/pull/18147?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#18147](https://codecov.io/gh/apache/pulsar/pull/18147?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c0a2f4e) into [master](https://codecov.io/gh/apache/pulsar/commit/6c65ca0d8a80bfaaa4d5869e0cea485f5c94369b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6c65ca0) will **increase** coverage by `35.87%`.
> The diff coverage is `50.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/pulsar/pull/18147/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pulsar/pull/18147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #18147 +/- ##
=============================================
+ Coverage 34.91% 70.79% +35.87%
+ Complexity 5707 438 -5269
=============================================
Files 607 26 -581
Lines 53396 2246 -51150
Branches 5712 245 -5467
=============================================
- Hits 18644 1590 -17054
+ Misses 32119 483 -31636
+ Partials 2633 173 -2460
```
| Flag | Coverage Δ | |
|---|---|---|
| unittests | `70.79% <50.00%> (+35.87%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pulsar/pull/18147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...apache/pulsar/proxy/server/DirectProxyHandler.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLXByb3h5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9wdWxzYXIvcHJveHkvc2VydmVyL0RpcmVjdFByb3h5SGFuZGxlci5qYXZh) | `63.63% <50.00%> (ø)` | |
| [...pache/pulsar/proxy/server/ProxyServiceStarter.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLXByb3h5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9wdWxzYXIvcHJveHkvc2VydmVyL1Byb3h5U2VydmljZVN0YXJ0ZXIuamF2YQ==) | `60.66% <0.00%> (-1.34%)` | :arrow_down: |
| [.../main/java/org/apache/pulsar/PulsarStandalone.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL1B1bHNhclN0YW5kYWxvbmUuamF2YQ==) | | |
| [...n/java/org/apache/pulsar/broker/PulsarService.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9QdWxzYXJTZXJ2aWNlLmphdmE=) | | |
| [.../org/apache/pulsar/broker/admin/AdminResource.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9BZG1pblJlc291cmNlLmphdmE=) | | |
| [.../apache/pulsar/broker/admin/impl/ClustersBase.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL0NsdXN0ZXJzQmFzZS5qYXZh) | | |
| [...pache/pulsar/broker/admin/impl/NamespacesBase.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL05hbWVzcGFjZXNCYXNlLmphdmE=) | | |
| [...pulsar/broker/admin/impl/PersistentTopicsBase.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL1BlcnNpc3RlbnRUb3BpY3NCYXNlLmphdmE=) | | |
| [.../pulsar/broker/admin/impl/SchemasResourceBase.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL1NjaGVtYXNSZXNvdXJjZUJhc2UuamF2YQ==) | | |
| [.../org/apache/pulsar/broker/admin/v2/Namespaces.java](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi92Mi9OYW1lc3BhY2VzLmphdmE=) | | |
| ... and [574 more](https://codecov.io/gh/apache/pulsar/pull/18147/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1001686399
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3624,6 +3624,8 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
LedgerOffloader ledgerOffloader = mock(NullLedgerOffloader.class);
OffloadPoliciesImpl offloadPolicies = mock(OffloadPoliciesImpl.class);
when(ledgerOffloader.getOffloadPolicies()).thenReturn(offloadPolicies);
+ when(ledgerOffloader.offload(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(null));
+ when(ledgerOffloader.getOffloadPolicies().getManagedLedgerOffloadThresholdInBytes()).thenReturn(-1L);
Review Comment:
```suggestion
when(offloadPolicies.getManagedLedgerOffloadThresholdInBytes()).thenReturn(-1L);
```
may only add this logic the test can become stable.
leger.close() will invoke `ledgerOffloader.getOffloadPolicies().getManagedLedgerOffloadThresholdInBytes()`
the first ledgerOffloader will open a timer task to call
https://github.com/apache/pulsar/blob/fa328a42d5770a27237d926eac97385284876174/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L2395
so we don't open this timer task is enough
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3643,7 +3645,10 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
+ });
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1001686757
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3643,7 +3645,10 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
+ });
Review Comment:
```suggestion
verify(ledgerOffloader, times(1)).getOffloadPolicies();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1002651434
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3643,7 +3645,10 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
+ });
Review Comment:
we only verify the method `internalTrimConsumedLedgers` can invoke getOffloadPolicies() onece, it is a sync method, so the times can't 0.
https://github.com/apache/pulsar/blob/c55be388ad769974a1fd16d43517f4cfda19aec0/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java#L3647
https://github.com/apache/pulsar/blob/c55be388ad769974a1fd16d43517f4cfda19aec0/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L2519
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1002488719
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3624,6 +3624,8 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
LedgerOffloader ledgerOffloader = mock(NullLedgerOffloader.class);
OffloadPoliciesImpl offloadPolicies = mock(OffloadPoliciesImpl.class);
when(ledgerOffloader.getOffloadPolicies()).thenReturn(offloadPolicies);
+ when(ledgerOffloader.offload(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(null));
+ when(ledgerOffloader.getOffloadPolicies().getManagedLedgerOffloadThresholdInBytes()).thenReturn(-1L);
Review Comment:
If not add
```
when(ledgerOffloader.offload(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(null))
```
The test will throw NPE
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3624,6 +3624,8 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
LedgerOffloader ledgerOffloader = mock(NullLedgerOffloader.class);
OffloadPoliciesImpl offloadPolicies = mock(OffloadPoliciesImpl.class);
when(ledgerOffloader.getOffloadPolicies()).thenReturn(offloadPolicies);
+ when(ledgerOffloader.offload(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(null));
+ when(ledgerOffloader.getOffloadPolicies().getManagedLedgerOffloadThresholdInBytes()).thenReturn(-1L);
Review Comment:
@congbobo184
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1002488824
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3643,7 +3645,10 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
+ });
Review Comment:
@congbobo184 Not stable, because it may call zero time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1001686757
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3643,7 +3645,10 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
+ });
Review Comment:
```suggestion
verify(finalLedgerOffloader, times(1)).getOffloadPolicies();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on a diff in pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on code in PR #18147:
URL: https://github.com/apache/pulsar/pull/18147#discussion_r1002846978
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -3645,7 +3648,11 @@ public void testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers() throws Exc
config.setLedgerOffloader(ledgerOffloader);
ledger.internalTrimConsumedLedgers(Futures.NULL_PROMISE);
- verify(ledgerOffloader, times(1)).getOffloadPolicies();
+ final LedgerOffloader finalLedgerOffloader = ledgerOffloader;
+ Awaitility.await().untilAsserted(() -> {
+ verify(finalLedgerOffloader, atLeastOnce()).getOffloadPolicies();
+ verify(finalLedgerOffloader, atMost(2)).getOffloadPolicies();
Review Comment:
@Technoboy- It's better to add a comment here to clarify why the method `getOffloadPolicies()` should be invoked once or twice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- merged pull request #18147: [fix][test] Fix flaky test `testDoNotGetOffloadPoliciesMultipleTimesWhenTrimLedgers`
Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #18147:
URL: https://github.com/apache/pulsar/pull/18147
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org