Skip to content

Conversation

@rickyma
Copy link
Contributor

@rickyma rickyma commented Apr 19, 2024

What changes were proposed in this pull request?

Fix some flaky tests.

Why are the changes needed?

Fix: #1662.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unnecessary.

@rickyma rickyma force-pushed the issue-1662 branch 3 times, most recently from 0f721dc to 3f5d5da Compare April 19, 2024 03:53
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 54.75%. Comparing base (222f5d4) to head (e13fe8f).
Report is 8 commits behind head on master.

Files Patch % Lines
...che/uniffle/client/impl/ShuffleReadClientImpl.java 0.00% 3 Missing and 1 partial ⚠️
...client/impl/grpc/ShuffleServerGrpcNettyClient.java 0.00% 2 Missing ⚠️
...e/shuffle/manager/ShuffleManagerServerFactory.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1663      +/-   ##
============================================
- Coverage     54.82%   54.75%   -0.08%     
- Complexity     2325     2741     +416     
============================================
  Files           366      403      +37     
  Lines         16218    21260    +5042     
  Branches       1482     2019     +537     
============================================
+ Hits           8892    11641    +2749     
- Misses         6804     8880    +2076     
- Partials        522      739     +217     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented Apr 19, 2024

Test Results

 2 377 files  + 77   2 377 suites  +77   4h 35m 34s ⏱️ + 34m 16s
   920 tests +  1     918 ✅ +  1   1 💤 ±0  0 ❌ ±0  1 🔥 ±0 
10 668 runs  +173  10 653 ✅ +175  14 💤 ±0  0 ❌ ±0  1 🔥  - 2 

For more details on these errors, see this check.

Results for commit 681a3a2. ± Comparison against base commit 45ad0b8.

This pull request removes 1 and adds 2 tests. Note that renamed tests count towards both.
org.apache.uniffle.shuffle.manager.ShuffleManagerServerFactoryTest ‑ testShuffleManagerServerType
org.apache.uniffle.shuffle.manager.ShuffleManagerServerFactoryTest ‑ testShuffleManagerServerType{ServerType}[1]
org.apache.uniffle.shuffle.manager.ShuffleManagerServerFactoryTest ‑ testShuffleManagerServerType{ServerType}[2]

♻️ This comment has been updated with latest results.

@EnricoMi
Copy link
Contributor

Looks like this PR contains changes that are not related to fixing flaky tests.


public class ShuffleManagerServerFactoryTest {
@Test
public void testShuffleManagerServerType() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use @ParameterizedTest and provide the server types as test parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@rickyma rickyma changed the title [#1662] fix(test): Fix flaky tests and update docs [#1662] fix(test): Fix flaky tests Apr 19, 2024
@rickyma
Copy link
Contributor Author

rickyma commented Apr 19, 2024

Looks like this PR contains changes that are not related to fixing flaky tests.

I've removed the docs part of code. I'll put it into another PR.

@rickyma rickyma requested a review from EnricoMi April 19, 2024 05:27
@Test
public void testShuffleManagerServerType() {
private static Stream<Arguments> shuffleManagerServerTypeProvider() {
return Stream.of(Arguments.of(ServerType.GRPC_NETTY), Arguments.of(ServerType.GRPC));
Copy link
Contributor

Choose a reason for hiding this comment

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

I liked the ServerType.values() that you had earlier, because this automatically tests all types if more are added:

Suggested change
return Stream.of(Arguments.of(ServerType.GRPC_NETTY), Arguments.of(ServerType.GRPC));
return Arrays.stream(ServerType.values());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

builder.offHeapEnable(offHeapEnabled);
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));
if (builder.getClientType() == null) {
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the builder not take the client type from the rss conf? Is there a use case wher rss conf has one client type but builder.getClientType() has a different type?

Copy link
Contributor Author

@rickyma rickyma Apr 19, 2024

Choose a reason for hiding this comment

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

This is an issue of historical oversight in the code; it's not written in a standard way. Normally speaking, if there are fields in the builder, which are not null, we should take from the builder first. If the builder doesn't have them, then we should take from RssConf. In the current production code, even if the builder has the field(which is not null), we still basically take it from RssConf.

And that is the reason why https://github.com/apache/incubator-uniffle/pull/1663/files#diff-2c63c456bb33c64e05cbb946b316f6b26ac9153fc8ef112024e47bf8c3fc3c5aR46 does not fail when we set rss.client.type to GRPC_NETTY. Because when calling the builder's build() method, the client type will be reset to the default value GRPC through RssConf, so there has actually been a hidden bug here all along.

Of course, it's not impossible to remove those fields from the builder and set them all through RssConf, it's just harder to maintain. I think, since we already have those fields in the builder, we should support setting them through the builder, otherwise it's better to remove them altogether.

@rickyma rickyma requested a review from EnricoMi April 20, 2024 06:12
public GrpcServer getServer(ShuffleManagerGrpcService service) {
ServerType type = conf.get(RssBaseConf.RPC_SERVER_TYPE);
if (type == ServerType.GRPC) {
if (type == ServerType.GRPC || type == ServerType.GRPC_NETTY) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not look like fixing flaky tests but like a feature + testing it. Maybe the PR title should be rephrased.

Copy link
Contributor

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

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

LGTM!

@rickyma rickyma changed the title [#1662] fix(test): Fix flaky tests [#1662] fix(test): Fix Netty related tests Apr 23, 2024
@zuston
Copy link
Member

zuston commented Apr 23, 2024

Could you help merge this? @EnricoMi

@zuston zuston merged commit 3bc0ee5 into apache:master Apr 25, 2024
jerqi pushed a commit that referenced this pull request Apr 30, 2024
### What changes were proposed in this pull request?

Fix some flaky tests.

### Why are the changes needed?

Fix: #1662.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Unnecessary.
@rickyma rickyma deleted the issue-1662 branch May 5, 2024 08:33
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.

[Bug] Fix flaky tests

4 participants