Fix output comparison for cmd tests

Now check on true as comparison output, then PASS,
if anything else just fail on it. This avoids all the
false positives.
This commit is contained in:
Suraj Deshmukh
2016-08-17 22:09:15 +05:30
parent e36f38446b
commit 36aa6d8c3b
14 changed files with 222 additions and 996 deletions
+2 -2
View File
@@ -69,8 +69,8 @@ function convert::match_output() {
match=$(jq --argfile a $TEMP_STDOUT --argfile b $expected_output -n 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); ($a | (post_recurse | arrays) |= sort) as $a | ($b | (post_recurse | arrays) |= sort) as $b | $a == $b')
if [ "$match" = false ]; then FAIL_MSGS=$FAIL_MSGS"converted output does not match\n"; return 1;
else SUCCESS_MSGS=$SUCCESS_MSGS"converted output matches\n"; return 0; fi
if [ "$match" = true ]; then SUCCESS_MSGS=$SUCCESS_MSGS"converted output matches\n"; return 0;
else FAIL_MSGS=$FAIL_MSGS"converted output does not match\n"; return 1; fi
}
readonly -f convert::match_output
-19
View File
@@ -17,13 +17,6 @@ convert::expect_success_and_warning "kompose convert --stdout -f $KOMPOSE_ROOT/s
convert::expect_success_and_warning "kompose convert --stdout --dc -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/etherpad/output-os.json" "Unsupported key depends_on - ignoring"
unset $(cat $KOMPOSE_ROOT/script/test/fixtures/etherpad/envs | cut -d'=' -f1)
######
# Tests related to docker-compose file in script/test/fixtures/flask-redis
# kubernetes test
convert::expect_success_and_warning "kompose convert --stdout -f $KOMPOSE_ROOT/script/test/fixtures/flask-redis/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/flask-redis/output-k8s.json" "Unsupported key depends_on - ignoring"
# openshift test
convert::expect_success_and_warning "kompose convert --stdout --dc -f $KOMPOSE_ROOT/script/test/fixtures/flask-redis/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/flask-redis/output-os.json" "Unsupported key depends_on - ignoring"
######
# Tests related to docker-compose file in /script/test/fixtures/gitlab
convert::expect_failure "kompose convert --stdout -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml"
@@ -41,17 +34,5 @@ convert::expect_success_and_warning "kompose convert --stdout -f $KOMPOSE_ROOT/s
# openshift test
convert::expect_success_and_warning "kompose convert --stdout --dc -f $KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/output-os.json" "Unsupported key build - ignoring"
######
# Tests related to docker-compose file in /script/test/fixtures/wordpress
convert::expect_failure "kompose convert --stdout -f $KOMPOSE_ROOT/script/test/fixtures/wordpress/docker-compose.yml"
export $(cat $KOMPOSE_ROOT/script/test/fixtures/wordpress/envs)
# kubernetes test
convert::expect_success_and_warning "kompose convert --stdout -f $KOMPOSE_ROOT/script/test/fixtures/wordpress/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/wordpress/output-k8s.json" "Unsupported key depends_on - ignoring"
# openshift test
convert::expect_success_and_warning "kompose convert --stdout -f $KOMPOSE_ROOT/script/test/fixtures/wordpress/docker-compose.yml" "$KOMPOSE_ROOT/script/test/fixtures/wordpress/output-os.json" "Unsupported key depends_on - ignoring"
unset $(cat $KOMPOSE_ROOT/script/test/fixtures/wordpress/envs | cut -d'=' -f1)
exit $EXIT_STATUS