minor cleanups and the addition of two extra tests covering previous bugs
@@ -16,7 +16,7 @@ set -euo pipefail
#
# Uses the `HAB_INTERNAL_BLDR_CHANNEL` environment variable to control
# the base packages channel for the exporter.
-HAB=$HAB_TEST_CMD || "hab"
+HAB=${HAB_TEST_CMD:-hab}
CACHE_DIR="test-cache"
IDENT_FILE="ident_file"
@@ -91,8 +91,6 @@ test_expecting_fail() {
else
echo "PASS (got error) $CMD"
fi;
-
-
}
success_from_command_line() {
@@ -108,7 +106,6 @@ success_from_command_line() {
}
success_from_file() {
-
before_test
echo "==========Testing file idents"
@@ -121,6 +118,24 @@ success_from_file() {
check_gzip_idents
}
+success_from_file_with_comments_and_emtpy_lines() {
+ before_test
+
+ echo "==========Testing file idents when file has white spaces and comments"
+
+ cat << IDENT_FILE > ${IDENT_FILE}
+# this is a series
+# of comments, followed by empty lines and whitespaces
+
+ core/gzip
+IDENT_FILE
+ CMD="$HAB pkg download --download-directory=${CACHE_DIR} --file=${IDENT_FILE}"
+ echo "Testing command line: ${CMD}"
+ ${CMD}
+
+ check_gzip_idents
+}
+
success_from_alternate_arch() {
before_test
@@ -140,6 +155,13 @@ bad_package_as_arg() {
test_expecting_fail "Bad package on command line" "$CMD"
}
+no_package_from_args() {
+ before_test
+
+ CMD="$HAB pkg download --download-directory=${CACHE_DIR}"
+ test_expecting_fail "No package identifers provided" "$CMD"
+}
+
bad_package_in_file() {
before_test
@@ -199,12 +221,14 @@ bad_channel() {
# functional tests
success_from_command_line
success_from_file
+success_from_file_with_comments_and_emtpy_lines
success_from_alternate_arch
# failure tests
bad_package_as_arg
+no_package_from_args
bad_package_in_file
no_such_package
cannot_create_dir
@@ -212,4 +236,3 @@ bad_target
bad_token
bad_url
bad_channel
-
