22
33# shellcheck disable=SC2034
44# unused variables are global in nature and used in testsupport.sh
5-
5+ test
66set -eo pipefail
77
88# Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,36 +22,154 @@ set -eo pipefail
2222
2323# shellcheck disable=SC1091
2424. dev-support/testrun-scripts/testsupport.sh
25+ init
26+
27+ resourceDir=src/test/resources/
28+ logdir=dev-support/testlogs/
29+ azureTestXml=azure-auth-keys.xml
30+ azureTestXmlPath=$resourceDir$azureTestXml
31+ processCount=8
2532
26- begin
33+ # # SECTION: TEST COMBINATION METHODS
2734
28- # ## ADD THE TEST COMBINATIONS BELOW. DO NOT EDIT THE ABOVE LINES.
29- # ## THE SCRIPT REQUIRES THE FOLLOWING UTILITIES xmlstarlet AND pcregrep.
35+ runHNSOAuthTest ()
36+ {
37+ accountName=$( xmlstarlet sel -t -v ' //property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath )
38+ PROPERTIES=(" fs.azure.account.auth.type" )
39+ VALUES=(" OAuth" )
40+ triggerRun " HNS-OAuth" " $accountName " " $runTest " $processCount " $cleanUpTestContainers "
41+ }
3042
43+ runHNSSharedKeyTest ()
44+ {
45+ accountName=$( xmlstarlet sel -t -v ' //property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath )
46+ PROPERTIES=(" fs.azure.account.auth.type" )
47+ VALUES=(" SharedKey" )
48+ triggerRun " HNS-SharedKey" " $accountName " " $runTest " $processCount " $cleanUpTestContainers "
49+ }
3150
32- combination=HNS-OAuth
33- properties=(" fs.azure.abfs.account.name" " fs.azure.test.namespace.enabled"
34- " fs.azure.account.auth.type" )
35- values=(" {account name}.dfs.core.windows.net" " true" " OAuth" )
36- generateconfigs
51+ runNonHNSSharedKeyTest ()
52+ {
53+ accountName=$( xmlstarlet sel -t -v ' //property[name = "fs.azure.nonHnsTestAccountName"]/value' -n $azureTestXmlPath )
54+ PROPERTIES=(" fs.azure.account.auth.type" )
55+ VALUES=(" SharedKey" )
56+ triggerRun " NonHNS-SharedKey" " $accountName " " $runTest " $processCount " $cleanUpTestContainers "
57+ }
3758
38- combination=AppendBlob-HNS-OAuth
39- properties=(" fs.azure.abfs.account.name" " fs.azure.test.namespace.enabled"
40- " fs.azure.account.auth.type" " fs.azure.test.appendblob.enabled" )
41- values=(" {account name}.dfs.core.windows.net" " true" " OAuth" " true" )
42- generateconfigs
59+ runAppendBlobHNSOAuthTest ()
60+ {
61+ accountName=$( xmlstarlet sel -t -v ' //property[name = "fs.azure.hnsTestAccountName"]/value' -n $azureTestXmlPath )
62+ PROPERTIES=(" fs.azure.account.auth.type" " fs.azure.test.appendblob.enabled" )
63+ VALUES=(" OAuth" " true" )
64+ triggerRun " AppendBlob-HNS-OAuth" " $accountName " " $runTest " $processCount " $cleanUpTestContainers "
65+ }
4366
44- combination=HNS-SharedKey
45- properties=(" fs.azure.abfs.account.name" " fs.azure.test.namespace.enabled" " fs.azure.account.auth.type" )
46- values=(" {account name}.dfs.core.windows.net" " true" " SharedKey" )
47- generateconfigs
67+ runTest=false
68+ cleanUpTestContainers=false
69+ echo ' Ensure below are complete before running script:'
70+ echo ' 1. Account specific settings file is present.'
71+ echo ' Copy accountName_settings.xml.template to accountName_settings.xml'
72+ echo ' where accountName in copied file name should be the test account name without domain'
73+ echo ' (accountName_settings.xml.template is present in src/test/resources/accountName_settings'
74+ echo ' folder. New account settings file to be added to same folder.)'
75+ echo ' Follow instructions in the template to populate settings correctly for the account'
76+ echo ' 2. In azure-auth-keys.xml, update properties fs.azure.hnsTestAccountName and fs.azure.nonHnsTestAccountName'
77+ echo ' where accountNames should be the test account names without domain'
78+ echo ' '
79+ echo ' '
80+ echo ' Choose action:'
81+ echo ' [Note - SET_ACTIVE_TEST_CONFIG will help activate the config for IDE/single test class runs]'
82+ select scriptMode in SET_ACTIVE_TEST_CONFIG RUN_TEST CLEAN_UP_OLD_TEST_CONTAINERS SET_OR_CHANGE_TEST_ACCOUNT PRINT_LOG4J_LOG_PATHS_FROM_LAST_RUN
83+ do
84+ case $scriptMode in
85+ SET_ACTIVE_TEST_CONFIG)
86+ runTest=false
87+ break
88+ ;;
89+ RUN_TEST)
90+ runTest=true
91+ read -r -p " Enter parallel test run process count [default - 8]: " processCount
92+ processCount=${processCount:- 8}
93+ break
94+ ;;
95+ CLEAN_UP_OLD_TEST_CONTAINERS)
96+ runTest=false
97+ cleanUpTestContainers=true
98+ break
99+ ;;
100+ SET_OR_CHANGE_TEST_ACCOUNT)
101+ runTest=false
102+ cleanUpTestContainers=false
103+ accountSettingsFile=" src/test/resources/azure-auth-keys.xml"
104+ if [[ ! -f " $accountSettingsFile " ]];
105+ then
106+ logOutput " No settings present. Creating new settings file ($accountSettingsFile ) from template"
107+ cp src/test/resources/azure-auth-keys.xml.template $accountSettingsFile
108+ fi
48109
49- combination=NonHNS-SharedKey
50- properties=(" fs.azure.abfs.account.name" " fs.azure.test.namespace.enabled" " fs.azure.account.auth.type" )
51- values=(" {account name}.dfs.core.windows.net" " false" " SharedKey" )
52- generateconfigs
110+ vi $accountSettingsFile
111+ exit 0
112+ break
113+ ;;
114+ PRINT_LOG4J_LOG_PATHS_FROM_LAST_RUN)
115+ runTest=false
116+ cleanUpTestContainers=false
117+ logFilePaths=/tmp/logPaths
118+ find target/ -name " *output.txt" > $logFilePaths
119+ logOutput " $( cat $logFilePaths ) "
120+ rm $logFilePaths
121+ exit 0
122+ break
123+ ;;
124+ * ) logOutput " ERROR: Invalid selection"
125+ ;;
126+ esac
127+ done
53128
129+ # # SECTION: COMBINATION DEFINITIONS AND TRIGGER
54130
55- # ## DO NOT EDIT THE LINES BELOW.
131+ echo ' '
132+ echo ' Set the active test combination to run the action:'
133+ select combo in HNS-OAuth HNS-SharedKey nonHNS-SharedKey AppendBlob-HNS-OAuth AllCombinationsTestRun Quit
134+ do
135+ case $combo in
136+ HNS-OAuth)
137+ runHNSOAuthTest
138+ break
139+ ;;
140+ HNS-SharedKey)
141+ runHNSSharedKeyTest
142+ break
143+ ;;
144+ nonHNS-SharedKey)
145+ runNonHNSSharedKeyTest
146+ break
147+ ;;
148+ AppendBlob-HNS-OAuth)
149+ runAppendBlobHNSOAuthTest
150+ break
151+ ;;
152+ AllCombinationsTestRun)
153+ if [ $runTest == false ]
154+ then
155+ logOutput " ERROR: Invalid selection for SET_ACTIVE_TEST_CONFIG. This is applicable only for RUN_TEST."
156+ break
157+ fi
158+ runHNSOAuthTest
159+ runHNSSharedKeyTest
160+ runNonHNSSharedKeyTest
161+ runAppendBlobHNSOAuthTest # # Keep this as the last run scenario always
162+ break
163+ ;;
164+ Quit)
165+ exit 0
166+ ;;
167+ * ) logOutput " ERROR: Invalid selection"
168+ ;;
169+ esac
170+ done
56171
57- runtests " $@ "
172+ if [ $runTest == true ]
173+ then
174+ printAggregate
175+ fi
0 commit comments