implement storing to dir/file, add tests

When kompose convert -o artifacts is run, then if artifacts is a directory,
kompose stores all the resulting files inside it, and if it's not a directory,
it stores the artifacts in a single file.

Fixes #209
This commit is contained in:
Shubham Minglani
2016-12-21 18:12:43 +05:30
parent c485a870d8
commit 365fe81987
6 changed files with 136 additions and 14 deletions
+26
View File
@@ -166,3 +166,29 @@ function convert::expect_failure() {
return $exit_status
}
readonly -f convert::expect_failure
function convert::files_exist() {
local cmd=$1
local dir=$2
convert::start_test "convert::files_exist: Running: '${cmd}'"
mkdir -p $dir 2> /dev/null
cd $TEMP_DIR && convert::run_cmd $cmd
exit_status=$?
shift
shift
for var in "$@"
do
if [ ! -f $var ]
then
convert::print_fail "file $var does not exist\n"
return 1
fi
convert::print_pass "file $var exists\n"
done
convert::teardown
return 0
}