-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18325: Fix test failures due to missing config #6847
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,10 @@ | |
import static org.apache.hadoop.fs.CommonConfigurationKeys.IOSTATISTICS_LOGGING_LEVEL_INFO; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_READ_BUFFER_SIZE; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_WRITE_BUFFER_SIZE; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_ACCOUNT_KEY; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_ACCOUNT_NAME; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_FORMAT; | ||
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_URI; | ||
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.MIN_BUFFER_SIZE; | ||
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_KB; | ||
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB; | ||
|
@@ -30,6 +33,8 @@ | |
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.FileSystem; | ||
import org.apache.hadoop.fs.azurebfs.utils.MetricFormat; | ||
|
||
import org.junit.Assume; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
@@ -47,6 +52,20 @@ | |
public class ITestAbfsReadFooterMetrics extends AbstractAbfsScaleTest { | ||
|
||
public ITestAbfsReadFooterMetrics() throws Exception { | ||
checkPrerequisites(); | ||
} | ||
|
||
private void checkPrerequisites(){ | ||
checkIfConfigIsSet(FS_AZURE_METRIC_ACCOUNT_NAME); | ||
checkIfConfigIsSet(FS_AZURE_METRIC_ACCOUNT_KEY); | ||
checkIfConfigIsSet(FS_AZURE_METRIC_URI); | ||
} | ||
|
||
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 commentThe 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 commentThe 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 |
||
value != null && value.trim().length() > 1); | ||
} | ||
|
||
private static final String TEST_PATH = "/testfile"; | ||
|
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