Skip to content

Commit

Permalink
test(fdb-list): cleanup after success
Browse files Browse the repository at this point in the history
  • Loading branch information
mcakircali committed Sep 13, 2024
1 parent 13eeff9 commit bf03921
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 14 deletions.
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_all.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -152,3 +155,6 @@ for i in 1 2; do
grep_count "$regex_y2" 24

done

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
8 changes: 6 additions & 2 deletions tests/fdb/tools/list/list_all_full.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -103,4 +106,5 @@ for i in 0 1; do

done

exit 0
echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
19 changes: 13 additions & 6 deletions tests/fdb/tools/list/list_depth.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ done
########################################################################################################################
# Create a grib file with 4 steps and populate FDB

try grib_set -s step=0 $src_data 0.grib
try grib_set -s step=6 $src_data 6.grib
try grib_set -s step=9 $src_data 9.grib
try grib_set -s step=0 $src_data data.0.grib
try grib_set -s step=6 $src_data data.6.grib
try grib_set -s step=9 $src_data data.9.grib

for f in *.grib; do
try grib_set -s type=an "$f" "cf.$f"
try grib_set -s type=an "$f" "data.an.${f#*.}"
done

for f in *.grib; do
try cat "$f" >> "$test_name.grib"
try cat "$f" >> "data.$test_name.grib"
done

try fdb-write "$test_name.grib"
try fdb-write "data.$test_name.grib"

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -91,3 +94,7 @@ exp="{class=rd,expver=xxxx,stream=oper,date=20201102,time=0000,domain=g}{type=an
{class=rd,expver=xxxx,stream=oper,date=20201102,time=0000,domain=g}{type=an,levtype=sfc}{step=9,param=166}"
out=$(try fdb-list type=an --minimum-keys="" --porcelain --depth=3)
try test "$exp" = "$out"


echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/*data.*.grib
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_location.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand All @@ -65,3 +68,6 @@ echo "Test: without the location flag, none of the location info is included"
try fdb-list class=rd,expver=xxxx,time=0000 --porcelain | tee out
line_count 12
grep_count "{class=rd,expver=xxxx,stream=oper,date=[0-9]+,time=0000,domain=g}{type=an,levtype=pl}{step=0,levelist=[0-9]+,param=[0-9]+}" 12

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_masking.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -75,3 +78,6 @@ line_count 8
echo "Test: All entries should be visible with --full"
try fdb-list class=rd,expver=xxxx,date=20240911/20240912,stream=oper,type=an,levtype=pl,param=130/138,levelist=300/123/1000 --porcelain --full | tee out
line_count 16

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_minimum_keys.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -75,3 +78,6 @@ done
echo "Test: the purge works now this is supplied"
try fdb-list --minimum-keys="class,expver,time" class=rd,expver=xxxx,time=1200 --porcelain | tee out
line_count 12

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_porcelain.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -113,3 +116,6 @@ echo "Test expansion of date and param with porcelain"
try fdb-list class=rd,expver=xxxx,date=20240911,stream=oper,type=an,levtype=pl,param=138 --porcelain | tee out
line_count 12
[[ $(grep '{class=rd,expver=xxxx' out | grep 'date=20240911' | grep param=138 | wc -l) -eq 12 ]] || die "Incorrect number of entries reported"

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib
8 changes: 7 additions & 1 deletion tests/fdb/tools/list/list_ranges.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ try mkdir -p $test_name/localroot
try cd $test_name

try cp "$src_dir/local.yaml" ./
try cp "$bin_dir/$src_data" ./
try ln -s "$bin_dir/$src_data" ./

work_dir=$(pwd)
echo "Working directory: $work_dir"

########################################################################################################################

Expand Down Expand Up @@ -83,3 +86,6 @@ line_count 72

try fdb-list class=rd,expver=xxxx,date=20240911/20240912/20241001,stream=oper,type=an,levtype=pl,param=60/155/138,levelist=300/123/1000 --porcelain | tee out
line_count 24

echo "cleanup"
try rm -rf "$work_dir/localroot" "$work_dir"/data.*.grib

0 comments on commit bf03921

Please sign in to comment.