jkube
jkube copied to clipboard
Fix HelmRepoTypeTest intermittent failures on ci
Component
JKube Kit
Task description
Description
HelmRepoTypeTest seems to be failing intermittently on CI (for example here):
[ERROR] Failures:
[ERROR] HelmRepoTypeTest.createConnection_withArtifactoryAndNoAuth_shouldReturnConnection:88
Expecting
<sun.net.www.protocol.https.DelegateHttpsURLConnection:https://example.com/base/chart.tar>
to have a property or a field named <"url">
[ERROR] HelmRepoTypeTest.createConnection_withChartMuseumAndAuth_shouldReturnConnection:69
Expecting
<sun.net.www.protocol.https.DelegateHttpsURLConnection:https://example.com/base/>
to have a property or a field named <"url">
[ERROR] HelmRepoTypeTest.createConnection_withChartMuseumAndNoAuth_shouldReturnConnection:51
Expecting
<sun.net.www.protocol.https.DelegateHttpsURLConnection:https://example.com/base/>
to have a property or a field named <"url">
[ERROR] HelmRepoTypeTest.createConnection_withNexusAndNoAuthAndTarGzExtension_shouldReturnConnectionToTgzUrl:105
Expecting
<sun.net.www.protocol.https.DelegateHttpsURLConnection:https://example.com/chart.tgz>
to have a property or a field named <"url">
[ERROR] HelmRepoTypeTest.createConnection_withNexusAndNoAuthAndTgzExtension_shouldReturnConnection:120
Expecting
<sun.net.www.protocol.https.DelegateHttpsURLConnection:https://example.com/base/chart.tgz>
to have a property or a field named <"url">
[INFO]
[ERROR] Tests run: 42, Failures: 5, Errors: 0, Skipped: 0
I'm not able to reproduce this locally. I think this could be a network issue but haven't investigated it thoroughly.
Expected Behavior
HelmRepoTypeTest should always pass when the code it's testing is not affected.
Acceptance Criteria
- [ ] HelmRepoTypeTest shouldn't fail intermittently on CircleCI
Ohh sh*t! I suppose I didn't pay attention when adding these verifications because this is the kind of puzzling thing you should remember.
For weird as it seems URL#equals performs a DNS resolution when performing equality checks. Besides the performance implications, this might cause 2 different URLs to be the same, or 2 "equal" URLs to be different.
These assertions should convert the URL to its external for prior to verifying their value.
For context:
- https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4434494
- https://news.ycombinator.com/item?id=21765788
The tests were refactored, issue should no longer be applicable