Skip to content

Commit 6de5360

Browse files
committed
Made easy to set or switch test account to use over script option
1 parent 794b470 commit 6de5360

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

hadoop-tools/hadoop-azure/dev-support/testrun-scripts/runtests.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@ processCount=8
3434

3535
runHNSOAuthTest()
3636
{
37-
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' $azureTestXmlPath)
37+
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath)
3838
PROPERTIES=("fs.azure.account.auth.type")
3939
VALUES=("OAuth")
4040
triggerRun "HNS-OAuth" "$accountName" "$runTest" $processCount "$cleanUpTestContainers"
4141
}
4242

4343
runHNSSharedKeyTest()
4444
{
45-
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' $azureTestXmlPath)
45+
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath)
4646
PROPERTIES=("fs.azure.account.auth.type")
4747
VALUES=("SharedKey")
4848
triggerRun "HNS-SharedKey" "$accountName" "$runTest" $processCount "$cleanUpTestContainers"
4949
}
5050

5151
runNonHNSSharedKeyTest()
5252
{
53-
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.nonHnsTestAccountName"]/value' $azureTestXmlPath)
53+
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.nonHnsTestAccountName"]/value' -n $azureTestXmlPath)
5454
PROPERTIES=("fs.azure.account.auth.type")
5555
VALUES=("SharedKey")
5656
triggerRun "NonHNS-SharedKey" "$accountName" "$runTest" $processCount "$cleanUpTestContainers"
5757
}
5858

5959
runAppendBlobHNSOAuthTest()
6060
{
61-
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' $azureTestXmlPath)
61+
accountName=$(xmlstarlet sel -t -v '//property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath)
6262
PROPERTIES=("fs.azure.account.auth.type" "fs.azure.test.appendblob.enabled")
6363
VALUES=("OAuth" "true")
6464
triggerRun "AppendBlob-HNS-OAuth" "$accountName" "$runTest" $processCount "$cleanUpTestContainers"
@@ -130,7 +130,7 @@ done
130130

131131
echo ' '
132132
echo 'Set the active test combination to run the action:'
133-
select combo in HNS-OAuth HNS-SharedKey nonHNS-SharedKey AppendBlob-HNS-OAuth All Quit
133+
select combo in HNS-OAuth HNS-SharedKey nonHNS-SharedKey AppendBlob-HNS-OAuth AllCombinationsTestRun Quit
134134
do
135135
case $combo in
136136
HNS-OAuth)
@@ -149,10 +149,10 @@ do
149149
runAppendBlobHNSOAuthTest
150150
break
151151
;;
152-
All)
152+
AllCombinationsTestRun)
153153
if [ $runTest == false ]
154154
then
155-
logOutput "ERROR: Invalid selection for SET_ACTIVE_TEST_CONFIG. This is applicable only for test runs."
155+
logOutput "ERROR: Invalid selection for SET_ACTIVE_TEST_CONFIG. This is applicable only for RUN_TEST."
156156
break
157157
fi
158158
runHNSOAuthTest

hadoop-tools/hadoop-azure/dev-support/testrun-scripts/testsupport.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ triggerRun()
4141
runTest=$3
4242
processcount=$4
4343
cleanUpTestContainers=$5
44+
45+
if [ -z "$accountName" ]; then
46+
logOutput "ERROR: Test account not configured. Re-run the script and choose SET_OR_CHANGE_TEST_ACCOUNT to configure the test account."
47+
exit 0;
48+
fi
4449
accountConfigFile=$accountSettingsFolderName/$accountName$accountConfigFileSuffix
4550
rm -rf $combtestfile
4651
cat > $combtestfile << ENDOFFILE
@@ -83,8 +88,7 @@ ENDOFFILE
8388
if [ "$cleanUpTestContainers" == true ]
8489
then
8590
mvn test -Dtest=org.apache.hadoop.fs.azurebfs.utils.CleanupTestContainers >> "$testlogfilename" || true
86-
if
87-
grep -c "There are test failures" $testlogfilename > 0
91+
if grep -q "There are test failures" "$testlogfilename";
8892
then logOutput "ERROR: All test containers could not be deleted. Detailed error cause in $testlogfilename"
8993
pcregrep -M "$testresultsregex" "$testlogfilename"
9094
exit 0
@@ -164,5 +168,5 @@ init() {
164168
}
165169

166170
logOutput() {
167-
echo -e $outputFormatOn $1 $outputFormatOff
171+
echo -e "$outputFormatOn" "$1" "$outputFormatOff"
168172
}

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCheckAccess.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import static org.apache.hadoop.fs.azurebfs.constants.TestConfigurationKeys.FS_AZURE_BLOB_FS_CLIENT_ID;
5151
import static org.apache.hadoop.fs.azurebfs.constants.TestConfigurationKeys.FS_AZURE_BLOB_FS_CLIENT_SECRET;
5252
import static org.apache.hadoop.fs.azurebfs.constants.TestConfigurationKeys.FS_AZURE_TEST_NAMESPACE_ENABLED_ACCOUNT;
53-
import static org.apache.hadoop.test.LambdaTestUtils.intercept;
5453

5554
/**
5655
* Test cases for AzureBlobFileSystem.access()

0 commit comments

Comments
 (0)