- # Check if the 3 chunk folders exist and they contain a ${app_path}/metadata file.
- ls $local_path/${chunk_pattern}-1/${app_path}/metadata >/dev/null
- ok $? "Chunk 1 exists"
- ls $local_path/${chunk_pattern}-2/${app_path}/metadata >/dev/null
- ok $? "Chunk 2 exists"
- ls $local_path/${chunk_pattern}-3/${domain} >/dev/null
- ok $? "Chunk 3 exists"
+ # Validate that only 3 chunks are present
+ nb_chunk=$(ls -A $local_path | wc -l)
+ test $nb_chunk -eq 3
+ ok $? "${local_path} contains 3 chunks only"
+
+ # Check if the first and second chunk folders exist and they contain a ${app_path}/metadata file.
+ for chunk in $(seq 1 2); do
+ path=$(ls $local_path/${chunk_pattern}-${chunk}/${app_path}/metadata)
+ ok $? "Chunk ${chunk} exists based on path $path"
+ done
+
+ # In per-pid the last chunk (3) must be empty.
+ if [ "${per_pid}" -eq "1" ]; then
+ test -z "$(ls -A $local_path/${chunk_pattern}-3/${domain})"
+ ok $? "Chunk 3 is empty per-pid mode"
+ else
+ path=$(ls $local_path/${chunk_pattern}-3/${app_path}/metadata)
+ ok $? "Chunk 3 exists based on path $path"
+ fi