Skip to content

Commit a48e785

Browse files
author
Hatim Chahout
committed
Amended test setup script to create param.bash from scratch. #66
1 parent e15b31d commit a48e785

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,4 @@ jobs:
3838
echo "PATH: $PATH"
3939
4040
- name: Run integration tests
41-
run: |
42-
source /usr/share/miniconda/etc/profile.d/conda.sh
43-
conda activate marval
44-
bash ./tests/run_tests.bash
41+
run: bash ./tests/run_tests.bash

tests/run_test_setup.bash

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,36 @@
44
# Exit immediately if a command exits with a non-zero status.
55
set -e
66

7-
# Mock the 'sbatch' command to write to stdout
8-
sbatch() {
9-
echo "MOCK SBATCH: $@"
10-
}
11-
export -f sbatch
12-
13-
# Mock other commands used in the run_proc.bash
7+
# Mock functions from run_proc.bash
8+
sbatch() { echo "MOCK SBATCH: $@"; }
149
slurm_wait() { :; }
1510
moo_wait() { :; }
1611
sacct() { echo ""; }
17-
squeue() { echo "P$$"; } # Add this new mock function
18-
export -f slurm_wait moo_wait sacct squeue
12+
squeue() { echo "P$$"; }
13+
export -f sbatch slurm_wait moo_wait sacct squeue
1914

2015
# Function to set up the temporary environment for a test
2116
function setup_test_env() {
2217
export TMP_DIR=$(mktemp -d)
23-
cp param.bash "$TMP_DIR/param.bash"
18+
19+
# Create an empty param.bash and add the mock paths to it
20+
touch "$TMP_DIR/param.bash"
21+
echo "export MARINE_VAL=$TMP_DIR" >> "$TMP_DIR/param.bash"
22+
echo "export MSKPATH=$TMP_DIR/MESH_MASK_DIR" >> "$TMP_DIR/param.bash"
23+
echo "export CDFPATH=$TMP_DIR/CDFTOOLS_DIR/bin" >> "$TMP_DIR/param.bash"
24+
echo "export NMLPATH=$TMP_DIR/nam_cdf_names" >> "$TMP_DIR/param.bash"
25+
echo "export OBSPATH=$TMP_DIR/OBS_PATH_DIR" >> "$TMP_DIR/param.bash"
26+
27+
# Create the necessary directories and files
2428
mkdir -p "$TMP_DIR/CDFTOOLS_DIR/bin"
2529
mkdir -p "$TMP_DIR/MESH_MASK_DIR"
30+
mkdir -p "$TMP_DIR/OBS_PATH_DIR"
2631
touch "$TMP_DIR/CDFTOOLS_DIR/bin/cdf_tool"
2732
touch "$TMP_DIR/MESH_MASK_DIR/mesh_mask.nc"
2833
touch "$TMP_DIR/MESH_MASK_DIR/bathy.nc"
2934
touch "$TMP_DIR/nam_cdf_names"
35+
touch "$TMP_DIR/OBS_PATH_DIR/your_obs_abs_sal_file.nc"
36+
touch "$TMP_DIR/OBS_PATH_DIR/your_obs_con_tem_file.nc"
3037
}
3138

3239
# Function to clean up the temporary environment after a test

0 commit comments

Comments
 (0)