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
Fix intermittent build failures #8312
Fix intermittent build failures #8312
Conversation
Could we somehow use random/available ports, there has to be a way to do that @vishesh92 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I don t think we should assign random ports, but make it deterministic. random is a sure way to get intermitted results in the end. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8312 +/- ##
============================================
+ Coverage 22.25% 27.92% +5.67%
- Complexity 22439 29729 +7290
============================================
Files 5117 5251 +134
Lines 346819 368797 +21978
Branches 49790 53765 +3975
============================================
+ Hits 77190 102993 +25803
+ Misses 258466 251569 -6897
- Partials 11163 14235 +3072
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I tried using wiremock's dynamicPort, but for some reason it's not working. |
Can you create a common util similar to the following to find a free port:
|
If dynamic ports are using a global registry it might work but predictability always suffers. Let's stick to this. |
+1 btw, can we specify a port range ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@vishesh92 will you be adding suggested changes in this PR or can it be done as a separate PR? |
@shwstppr Let me make the change in this PR itself. |
4b46737
to
1b4c9be
Compare
@kishankavala @shwstppr @DaanHoogland I have made the changes to randomly select a port. |
@@ -60,6 +63,15 @@ public void setUp() throws Exception { | |||
client = new NetworkerClient(url, adminUsername, adminPassword, false, 60); | |||
} | |||
|
|||
private int getRandomPort() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be in a util class, so that other tests can also use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. But let's do that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not do this. let's keep it deterministic.
There are options to specify a range, but didn't look efficient to me. |
@@ -87,7 +99,7 @@ public void testListPolicies() { | |||
" \"comment\": \"-CSBKP-\",\n" + | |||
" \"links\": [\n" + | |||
" {\n" + | |||
" \"href\": \"http://localhost:9399/nwrestapi/v3/global/protectionpolicies/CSBRONZE\",\n" + | |||
" \"href\": \"http://localhost:9400/nwrestapi/v3/global/protectionpolicies/CSBRONZE\",\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to use url
instead, the port might be different as 9400
private final String url = "http://localhost:" + port + "/nwrestapi/v3";
@@ -60,6 +63,15 @@ public void setUp() throws Exception { | |||
client = new NetworkerClient(url, adminUsername, adminPassword, false, 60); | |||
} | |||
|
|||
private int getRandomPort() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not do this. let's keep it deterministic.
1b4c9be
to
1449aa3
Compare
Let's fix the intermittent build failures for now. If random port is required, let's do that in a separate PR. Reverting the change for the random port for now and moving ahead with the fixed port. |
@vishesh92 cc @DaanHoogland @kishankavala @weizhouapache I propose we move forward with this for now to address build failure and maybe create an issue or PR with more holistic changes to make a common util class to fetch an available port for different tests (in some range). Does that work? |
fine with me . let's use port 9400 for now. |
Description
This PR fixes intermittent build failures which happen due to parallel test runs. As of now port 9399 is being used in NetworkerClientTest & VeeamClientTest. This PR updates the port in NetworkerClientTest from 9399 to 9400.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?