@@ -75,6 +75,12 @@ get_endpoint()
7575 esac
7676}
7777
78+ confirm () {
79+ read -p " $1 (y/n): " -n 1 -r
80+ echo
81+ [[ $REPLY =~ ^[Yy]$ ]]
82+ }
83+
7884# Tests #######################################################################
7985test_single_auth_code ()
8086{
@@ -92,6 +98,11 @@ test_single_auth_code()
9298 TOKEN_FILE=${HOME} /.zstash_globus_tokens.json
9399
94100 # Start fresh
101+ echo " Reset Globus consents:"
102+ echo " https://auth.globus.org/v2/web/consents > Globus Endpoint Performance Monitoring > rescind all"
103+ if ! confirm " Have you revoked Globus consents?" ; then
104+ exit 1
105+ fi
95106 rm -rf ${GLOBUS_CFG}
96107 rm -rf ${INI_PATH}
97108 rm -rf ${TOKEN_FILE}
@@ -154,6 +165,14 @@ test_single_auth_code()
154165 check_log_has " dir/file0.txt" run2_ls.log
155166 check_log_has " empty_dir" run2_ls.log
156167 # Could also test -l and -v options, but the above code covers the important part.
168+
169+ if ! confirm " Did you only have to paste an auth code once (for run1, not run2)?" ; then
170+ echo " Single-authentication test failed"
171+ exit 1
172+ fi
173+ # Cleanup:
174+ cd ${path_to_repo} /tests/integration/bash_tests/run_from_any
175+ rm -rf ${path_to_repo} /tests/utils/globus_auth
157176}
158177
159178test_different_endpoint1 ()
@@ -178,8 +197,16 @@ test_different_endpoint1()
178197 check_log_has " ERROR: One possible cause" ${case_name} .log
179198 check_log_has " ERROR: Try deleting" ${case_name} .log
180199 check_log_has " ERROR: Another possible cause" ${case_name} .log
181- check_log_has " ERROR: try revoking consents before re-running" ${case_name} .log
200+ check_log_has " try revoking consents before re-running" ${case_name} .log
182201 check_log_has " ERROR: Exception: Insufficient Globus consents" ${case_name} .log
202+
203+ if ! confirm " Did you avoid having to paste any auth codes on this run?" ; then
204+ echo " test_different_endpoint1 failed"
205+ exit 1
206+ fi
207+ # Cleanup:
208+ cd ${path_to_repo} /tests/integration/bash_tests/run_from_any
209+ rm -rf ${path_to_repo} /tests/utils/globus_auth
183210}
184211
185212test_different_endpoint2 ()
@@ -193,6 +220,12 @@ test_different_endpoint2()
193220 dst_endpoint_uuid=$( get_endpoint ${dst_endpoint} )
194221 globus_path=globus://${dst_endpoint_uuid} /${dst_dir}
195222
223+ echo " Reset Globus consents:"
224+ echo " https://auth.globus.org/v2/web/consents > Globus Endpoint Performance Monitoring > rescind all"
225+ if ! confirm " Have you revoked Globus consents?" ; then
226+ exit 1
227+ fi
228+
196229 echo " Running test_different_endpoint2"
197230 echo " Exit codes: 0 -- success, 1 -- failure"
198231
@@ -213,6 +246,14 @@ test_different_endpoint2()
213246 echo " ${case_name} failed. Check ${case_name} _create.log for details."
214247 exit 1
215248 fi
249+
250+ if ! confirm " Did you only have to paste an auth code once (for 2b, not 2a)?" ; then
251+ echo " test_different_endpoint2 failed"
252+ exit 1
253+ fi
254+ # Cleanup:
255+ cd ${path_to_repo} /tests/integration/bash_tests/run_from_any
256+ rm -rf ${path_to_repo} /tests/utils/globus_auth
216257}
217258
218259test_different_endpoint3 ()
@@ -239,59 +280,73 @@ test_different_endpoint3()
239280 exit 1
240281 fi
241282
283+ if ! confirm " Did you only have to paste an auth code once?" ; then
284+ echo " test_different_endpoint2 failed"
285+ exit 1
286+ fi
287+ # Cleanup:
288+ cd ${path_to_repo} /tests/integration/bash_tests/run_from_any
289+ rm -rf ${path_to_repo} /tests/utils/globus_auth
242290}
243291
244292# Follow these directions #####################################################
245- # Modify these parameters as needed.
246-
247- # Step 1. Update try_num for each new test run to avoid conflicts with previous runs.
248- # Alternative: Remove previous test directories manually.
249- try_num=18
250-
251- # Step 2. Set paths for your environment by uncommenting the appropriate lines.
252- # Ordered by: Chrysalis, Perlmutter, Compy
253- # Running from:
254- path_to_repo=/home/ac.forsyth2/ez/zstash/
255- # path_to_repo=/global/homes/f/forsyth/ez/zstash
256- # path_to_repo=/qfs/people/fors729/ez/zstash
257- # Archiving to:
258- chrysalis_dst_dir=/home/ac.forsyth2/zstash_tests/test_globus_auth_try${try_num}
259- perlmutter_dst_dir=/global/homes/f/forsyth/zstash_tests/test_globus_auth_try${try_num}
260- hpss_dst_dir=/home/f/forsyth/zstash_tests/test_globus_auth_try${try_num}
261- compy_dst_dir=/compyfs/fors729/zstash_tests/test_globus_auth_try${try_num} # Using /qfs/people/fors729/ will result in permission denied
262-
263- # Step 3. Run the test cases for each endpoint.
264- # Do once: https://app.globus.org/file-manager?two_pane=true > For "Collection", select the endpoint for the machine you're on, and authenticate if needed.
265- # For each line below:
266- # A. Uncomment the appropriate line
267- # B. https://app.globus.org/file-manager?two_pane=true > For "Collection", select the dst_endpoint name, and authenticate if needed.
268- # C. https://auth.globus.org/v2/web/consents > Manage Your Consents > Globus Endpoint Performance Monitoring > rescind all"
269- # D. Run the script with `./globus_auth.bash`
270- # - Paste the URL into your browser
271- # - Authenticate to src_endpoint if needed.
272- # - Authenticate to dst_endpoint if needed.
273- # - Provide a label
274- # - Copy the auth code to the command line
275- # - If the test hangs: check https://app.globus.org/activity for errors.
276- # - If you have to paste an auth code more than once, that counts as an error.
277- # E. Cleanup
278- # - Re-comment the line
279- # - `rm -rf ../../../utils/globus_auth` to remove test directories
280- # test_single_auth_code ${path_to_repo} LCRC_IMPROV_DTN_ENDPOINT ${chrysalis_dst_dir}
281- # test_single_auth_code ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
282- # test_single_auth_code ${path_to_repo} NERSC_HPSS_ENDPOINT ${hpss_dst_dir}
283- # test_single_auth_code ${path_to_repo} PIC_COMPY_DTN_ENDPOINT ${compy_dst_dir}
284-
285- # Step 4. Now, some follow-up tests
286-
287- # Make sure you use a different endpoint than the last one tested above.
288- # Uncomment, run (expecting no auth codes to paste), re-comment:
289- # test_different_endpoint1 ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
290-
291- # Reset consents again: https://auth.globus.org/v2/web/consents > Manage Your Consents > Globus Endpoint Performance Monitoring > rescind all"
292- # Uncomment, run (expecting 1 auth code to paste), re-comment:
293- # test_different_endpoint2 ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
294-
295- # Uncomment, run (expecting 1 auth code to paste), re-comment:
293+
294+ # Example usage:
295+ # ./globus_auth.bash 21 /home/ac.forsyth2/ez/zstash /home/ac.forsyth2/zstash_tests /global/homes/f/forsyth/zstash_tests /home/f/forsyth/zstash_tests /compyfs/fors729/zstash_tests
296+
297+ # Command line parameters:
298+ try_num=" $1 "
299+ path_to_repo=" $2 " # /home/ac.forsyth2/ez/zstash, /global/homes/f/forsyth/ez/zstash, /qfs/people/fors729/ez/zstash
300+ chrysalis_dst_basedir=" $3 " # /home/ac.forsyth2/zstash_tests
301+ perlmutter_dst_basedir=" $4 " # /global/homes/f/forsyth/zstash_tests
302+ hpss_dst_basedir=" $5 " # /home/f/forsyth/zstash_tests
303+ compy_dst_basedir=" $6 " # /compyfs/fors729/zstash_tests (/qfs/people/fors729/ => permission denied)
304+
305+ echo " You may wish to clear your dst directories for a fresh start:"
306+ echo " Chrysalis: rm -rf ${chrysalis_dst_basedir} /test_globus_auth*"
307+ echo " Perlmutter: rm -rf ${perlmutter_dst_basedir} /test_globus_auth*"
308+ echo " Compy: rm -rf ${compy_dst_basedir} /test_globus_auth*"
309+ echo " This won't work on HPSS, because -rf flags are unsupported:"
310+ echo " NERSC HPSS: rm -rf ${hpss_dst_basedir} /test_globus_auth*"
311+ echo " "
312+ echo " It is therefore advisable to just increment a 'try number' to avoid directory conflicts."
313+ echo " Currently, try_num=${try_num} "
314+ if ! confirm " Is the try_num correct?" ; then
315+ exit 1
316+ fi
317+
318+ chrysalis_dst_dir=${chrysalis_dst_basedir} /test_globus_auth_try${try_num}
319+ perlmutter_dst_dir=${perlmutter_dst_basedir} /test_globus_auth_try${try_num}
320+ hpss_dst_dir=${hpss_dst_basedir} /test_globus_auth_try${try_num}
321+ compy_dst_dir=${compy_dst_basedir} /test_globus_auth_try${try_num}
322+
323+ echo " Go to https://app.globus.org/file-manager?two_pane=true > For " Collection" , choose each of the following endpoints and, if needed, authenticate:"
324+ echo " LCRC Improv DTN, NERSC Perlmutter, NERSC HPSS, pic#compy-dtn"
325+ if ! confirm " Have you authenticated into all endpoints?" ; then
326+ exit 1
327+ fi
328+
329+ echo " Primary tests: single authentication code tests for each endpoint"
330+ echo " If a test hangs, check if https://app.globus.org/activity reports any errors on your transfers."
331+ echo " Testing transfer to LCRC Improv DTN ####################################"
332+ test_single_auth_code ${path_to_repo} LCRC_IMPROV_DTN_ENDPOINT ${chrysalis_dst_dir}
333+ echo " Testing transfer to NERSC Perlmutter ###################################"
334+ test_single_auth_code ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
335+ echo " Testing transfer to NERSC HPSS #########################################"
336+ test_single_auth_code ${path_to_repo} NERSC_HPSS_ENDPOINT ${hpss_dst_dir}
337+ echo " Testing transfer to pic#compy-dtn ######################################"
338+ test_single_auth_code ${path_to_repo} PIC_COMPY_DTN_ENDPOINT ${compy_dst_dir}
339+
340+ echo " Follow-up tests: behavior when switching to different endpoints"
341+ echo " NOTE: if you commented out tests above, and your last endpoint used was NERSC_PERLMUTTER_ENDPOINT, the following test will not work properly."
342+ echo " Test 1: What if we switch to a different endpoint? #####################"
343+ test_different_endpoint1 ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
344+ echo " Test 2: What if we try a) revoking consents and then b) removing the token file? ###"
345+ test_different_endpoint2 ${path_to_repo} NERSC_PERLMUTTER_ENDPOINT ${perlmutter_dst_dir}
346+ echo " Test 3: What if we switch to a different endpoint again, but first remove the token file? ###"
296347test_different_endpoint3 ${path_to_repo} NERSC_HPSS_ENDPOINT ${hpss_dst_dir}
297- # Check https://auth.globus.org/v2/web/consents: you should have *two* consents there now.
348+ echo " Check https://auth.globus.org/v2/web/consents > Globus Endpoint Performance Monitoring: you should have *two* consents there now."
349+ if ! confirm " Does https://auth.globus.org/v2/web/consents > Globus Endpoint Performance Monitoring show *two* consents?" ; then
350+ exit 1
351+ fi
352+ echo " All globus_auth tests completed successfully."
0 commit comments