Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix output comparison for cmd tests #110

Merged
merged 1 commit into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions script/test/cmd/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to check if the output is true, everything else will act as fail!

else FAIL_MSGS=$FAIL_MSGS"converted output does not match\n"; return 1; fi
}
readonly -f convert::match_output

Expand Down
19 changes: 0 additions & 19 deletions script/test/cmd/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

76 changes: 38 additions & 38 deletions script/test/fixtures/etherpad/output-k8s.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,44 @@
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null,
"name": "mariadb",
"creationTimestamp": null
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated test fixtures on current master.

},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "etherpad"
"service": "mariadb"
}
},
"spec": {
"containers": [
{
"name": "etherpad",
"image": "centos/etherpad",
"name": "mariadb",
"image": "centos/mariadb",
"ports": [
{
"containerPort": 9001,
"containerPort": 3306,
"protocol": "TCP"
}
],
"env": [
{
"name": "DB_DBID",
"name": "MYSQL_DATABASE",
"value": "etherpad"
},
{
"name": "DB_HOST",
"value": "mariadb"
},
{
"name": "DB_PASS",
"name": "MYSQL_PASSWORD",
"value": "etherpad"
},
{
"name": "DB_PORT",
"value": "3306"
"name": "MYSQL_ROOT_PASSWORD",
"value": "etherpad"
},
{
"name": "DB_USER",
"name": "MYSQL_USER",
"value": "etherpad"
}
],
Expand All @@ -66,23 +62,23 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "etherpad",
"name": "mariadb",
"creationTimestamp": null,
"labels": {
"service": "etherpad"
"service": "mariadb"
}
},
"spec": {
"ports": [
{
"name": "80",
"name": "3306",
"protocol": "TCP",
"port": 80,
"targetPort": 9001
"port": 3306,
"targetPort": 3306
}
],
"selector": {
"service": "etherpad"
"service": "mariadb"
}
},
"status": {
Expand All @@ -93,45 +89,49 @@
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null,
"name": "etherpad",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "mariadb"
"service": "etherpad"
}
},
"spec": {
"containers": [
{
"name": "mariadb",
"image": "centos/mariadb",
"name": "etherpad",
"image": "centos/etherpad",
"ports": [
{
"containerPort": 3306,
"containerPort": 9001,
"protocol": "TCP"
}
],
"env": [
{
"name": "MYSQL_USER",
"name": "DB_USER",
"value": "etherpad"
},
{
"name": "MYSQL_DATABASE",
"name": "DB_DBID",
"value": "etherpad"
},
{
"name": "MYSQL_PASSWORD",
"value": "etherpad"
"name": "DB_HOST",
"value": "mariadb"
},
{
"name": "MYSQL_ROOT_PASSWORD",
"name": "DB_PASS",
"value": "etherpad"
},
{
"name": "DB_PORT",
"value": "3306"
}
],
"resources": {}
Expand All @@ -148,23 +148,23 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "mariadb",
"name": "etherpad",
"creationTimestamp": null,
"labels": {
"service": "mariadb"
"service": "etherpad"
}
},
"spec": {
"ports": [
{
"name": "3306",
"name": "80",
"protocol": "TCP",
"port": 3306,
"targetPort": 3306
"port": 80,
"targetPort": 9001
}
],
"selector": {
"service": "mariadb"
"service": "etherpad"
}
},
"status": {
Expand Down
10 changes: 0 additions & 10 deletions script/test/fixtures/flask-redis/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions script/test/fixtures/flask-redis/docker-compose.yml

This file was deleted.

Loading