-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
HADOOP-18325: Fix test failures due to missing config #6847
HADOOP-18325: Fix test failures due to missing config #6847
Conversation
🎊 +1 overall
This message was automatically generated. |
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.
Great pr! Small comments! Thanks.
metricAccountKey); | ||
} catch (IllegalArgumentException e) { | ||
throw new IOException("Exception while initializing metric credentials " + e); | ||
if (!metricAccountName.equals(EMPTY_STRING) && !metricAccountKey.equals(EMPTY_STRING)) { |
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.
would be better if we can use StringUtils.isNotEmpty(), as it would null and empty checks.
metricAccountKey); | ||
} catch (IllegalArgumentException e) { | ||
throw new IOException( | ||
"Exception while initializing metric credentials " + e); |
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.
throw new IOException(message, e) would be better as the consumer of this exception can get the inner-exception.
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.
Great code! Thanks for taking the comments. +1.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
Thanks @anmolanmol1234 for the PR. Added a few comments, pls go through it.
private void checkIfConfigIsSet(String configKey){ | ||
AbfsConfiguration conf = getConfiguration(); | ||
String value = conf.get(configKey); | ||
Assume.assumeTrue(configKey + " config is mandatory for the test to run", |
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.
@anmolanmol1234 Should this be Assert.assertTrue instead of Assume.assumeTrue ?
Assume will skip the test in case of failure.
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.
We want to skip the tests if the config is not present hence Assume.assumeTrue
private void checkIfConfigIsSet(String configKey){ | ||
AbfsConfiguration conf = getConfiguration(); | ||
String value = conf.get(configKey); | ||
Assume.assumeTrue(configKey + " config is mandatory for the test to run", |
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.
@anmolanmol1234 Should this be Assert.assertTrue instead of Assume.assumeTrue ?
Assume will skip the test in case of failure.
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.
We want to skip the tests if the config is not present hence Assume.assumeTrue
} | ||
|
||
private void checkPrerequisites(){ | ||
checkIfConfigIsSet(FS_AZURE_METRIC_ACCOUNT_NAME); |
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.
We have a method in base class already defined for this purpose. We can use that itself assumeValidTestConfigPresent
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.
Taken
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.
nit: Here also we could have used the assumeValidTestConfigPresent
method
@anmolanmol1234 please resolve the merge conflicts and add latest test result after trunk backmerge. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
============================================================
|
Have updated the same |
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.
- 1
Looks good to me. Thanks for the patch
} | ||
|
||
private void checkPrerequisites(){ | ||
checkIfConfigIsSet(FS_AZURE_METRIC_ACCOUNT_NAME); |
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.
nit: Here also we could have used the assumeValidTestConfigPresent
method
@anmolanmol1234 please do a 3.4 backport and trigger a test run for validation. |
…config (apache#6847) Fixing test failures when the needed configs for metric collection are not set Contributed by: Anmol Asrani
PR fixes the test failures when the needed configs for metric collection are not set