Skip to content

Commit cc1a301

Browse files
committed
Packaging test: add guard for too many files
If you assert that a pattern of files exists but it matches more then one file the "assert this file exists" code failed with a misleading error message. This tests if the patter resolved to multiple files and prints a better error message if it did.
1 parent 2994366 commit cc1a301

File tree

1 file changed

+5
-0
lines changed
  • qa/vagrant/src/test/resources/packaging/utils

1 file changed

+5
-0
lines changed

qa/vagrant/src/test/resources/packaging/utils/utils.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ skip_not_zip() {
139139

140140
assert_file_exist() {
141141
local file="$1"
142+
local count=$(echo "$file" | wc -l)
143+
[[ "$count" == "1" ]] || {
144+
echo "assert_file_exist must be run on a single file at a time but was called on [$count] files: $file"
145+
false
146+
}
142147
if [ ! -e "$file" ]; then
143148
echo "Should exist: ${file} but does not"
144149
fi

0 commit comments

Comments
 (0)