|
| 1 | +# zstash Test Suite |
| 2 | + |
| 3 | +## The test directory structure |
| 4 | + |
| 5 | +``` |
| 6 | +tests/ |
| 7 | + integration/ # Tests that call zstash from the command line |
| 8 | + bash_tests/ # Test zstash commands via bash scripts |
| 9 | + run_from_chrysalis/ # Run these from Chrysalis (these use Globus and/or require the Chrysalis file system) |
| 10 | + run_from_perlmutter/ # Run these from Perlmutter (these use `hsi` directly and/or require the Perlmutter file system) |
| 11 | + python_tests/ # Test zstash commands via Python unittest wrappers |
| 12 | + group_by_command # Tests organized by command |
| 13 | + group_by_workflow # Tests organized by workflow |
| 14 | + unit/ # Tests of pure functions (uses pytest, not unittest) |
| 15 | + utils/ # Utilities for testing |
| 16 | +``` |
| 17 | + |
| 18 | +## Testing example for Perlmutter |
| 19 | + |
| 20 | +```bash |
| 21 | +rm -rf build |
| 22 | +conda clean --all --y |
| 23 | +conda env create -f conda/dev.yml -n zstash_dev_20251017_test1 |
| 24 | +conda activate zstash_dev_20251017_test1 |
| 25 | +pre-commit run --all-files |
| 26 | +python -m pip install . |
| 27 | +pytest tests/unit/test_*.py |
| 28 | +# 1 passed in 0.19s |
| 29 | +python -m unittest tests/integration/python_tests/group_by_command/test_*.py |
| 30 | +# Ran 69 tests in 327.570s |
| 31 | +# OK |
| 32 | +python -m unittest tests/integration/python_tests/group_by_workflow/test_*.py |
| 33 | +# Ran 4 tests in 2.666s |
| 34 | +# OK |
| 35 | +cd tests/integration/bash_tests/run_from_perlmutter/ |
| 36 | +time ./follow_symlinks.sh # NOTE: you will have to change out paths for your username |
| 37 | +# real 0m31.851s |
| 38 | +# No errors |
| 39 | +time ./test_update_non_empty_hpss.bash |
| 40 | +# real 0m10.062s |
| 41 | +# No errors |
| 42 | + |
| 43 | +# Log into globus.org |
| 44 | +# Log into endpoints (NERSC Perlmutter, Globus Tutorial Collection 1) at globus.org: File Manager > Add the endpoints in the "Collection" fields |
| 45 | +time ./test_ls_globus.bash |
| 46 | +# real 0m26.930s |
| 47 | +# No errors |
| 48 | +``` |
| 49 | + |
| 50 | +## Testing example for Chrysalis |
| 51 | + |
| 52 | +```bash |
| 53 | +rm -rf build |
| 54 | +conda clean --all --y |
| 55 | +conda env create -f conda/dev.yml -n zstash_dev_20251017_test1 |
| 56 | +conda activate zstash_dev_20251017_test1 |
| 57 | +pre-commit run --all-files |
| 58 | +python -m pip install . |
| 59 | +pytest tests/unit/test_*.py |
| 60 | +# 1 passed in 0.84s |
| 61 | +python -m unittest tests/integration/python_tests/group_by_command/test_*.py |
| 62 | +# Ran 69 tests in 110.139s |
| 63 | +# OK (skipped=32) |
| 64 | +# NOTE: Some tests are skipped because Chrysalis doesn't have direct `hsi`/HPSS access |
| 65 | +python -m unittest tests/integration/python_tests/group_by_workflow/test_*.py |
| 66 | +# Ran 4 tests in 6.889s |
| 67 | +# OK |
| 68 | +cd tests/integration/bash_tests/run_from_chrysalis/ |
| 69 | + |
| 70 | +# Log into globus.org |
| 71 | +# 1. Log into endpoints (LCRC Improv DTN, NERSC Perlmutter) at globus.org: File Manager > Add the endpoints in the "Collection" fields |
| 72 | +# 2. To start fresh, with no consents: https://auth.globus.org/v2/web/consents > Manage Your Consents > Globus Endpoint Performance Monitoring > rescind all" |
| 73 | +# Then, increment `try_num` below to avoid using an old directory. |
| 74 | +# Alternatively, start fresh by deleting the directory on Perlmutter: |
| 75 | +# `rm -rf /global/homes/f/forsyth/zstash/tests/test_globus_auth_try{try_num}` |
| 76 | +time ./globus_auth.bash try_num # NOTE: you will have to change out paths for your username |
| 77 | +# Paste the URL into your browser |
| 78 | +# Log into Argonne |
| 79 | +# Log into NERSC |
| 80 | +# Provide a label |
| 81 | +# Copy the auth code to the command line |
| 82 | +# |
| 83 | +# real 2m45.954s |
| 84 | +# No errors |
| 85 | + |
| 86 | +# If not done above, do the following: |
| 87 | +# Log into globus.org |
| 88 | +# Log into endpoints (LCRC Improv DTN, NERSC Perlmutter) at globus.org: File Manager > Add the endpoints in the "Collection" fields |
| 89 | + |
| 90 | +# In all cases, do: |
| 91 | +# Then, increment `try_num` below to avoid using an old directory. |
| 92 | +# Alternatively, start fresh by deleting the directory on Perlmutter: |
| 93 | +# `rm -rf /global/homes/f/forsyth/zstash/tests/test_database_corruption_try{try_num}` |
| 94 | +time ./database_corruption.bash try_num # NOTE: you will have to change out paths for your username |
| 95 | +# Success count: 25 |
| 96 | +# Fail count: 0 |
| 97 | +# real 6m43.994s |
| 98 | + |
| 99 | +time ./symlinks.sh # NOTE: you will have to change out paths for your username |
| 100 | +# real 0m1.346s |
| 101 | +# No errors |
| 102 | + |
| 103 | +cd blocking_test_scripts |
| 104 | +# Review README_TEST_BLOCKING |
| 105 | +# This uses "12 piControl ocean monthly files, 49 GB", |
| 106 | +# so processing may take a long time. |
| 107 | +# TODO (later PR): Confirm this test works |
| 108 | +``` |
| 109 | + |
| 110 | +## Testing with GitHub Actions |
| 111 | + |
| 112 | +GitHub Actions runs the tests according to `.github/workflows/build_workflow.yml`: |
| 113 | +``` |
| 114 | + # Run machine-independent tests |
| 115 | + - name: Run Tests |
| 116 | + run: | |
| 117 | + pytest tests/unit/test_*.py |
| 118 | + python -m unittest tests/integration/python_tests/group_by_command/test_*.py |
| 119 | + python -m unittest tests/integration/python_tests/group_by_workflow/test_*.py |
| 120 | +``` |
0 commit comments