Fixed functional tests

Fixes #431

fixed commands where output showing `command not found` and k8s output
added for restart-options example.
This commit is contained in:
Suraj Narwade 2017-03-30 11:22:26 +05:30
parent 309d5a9f7f
commit df014bebd6
4 changed files with 201 additions and 150 deletions

View File

@ -45,7 +45,7 @@ unset $(cat $KOMPOSE_ROOT/script/test/fixtures/gitlab/envs | cut -d'=' -f1)
# kubernetes test # kubernetes test
convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/output-k8s.json" "Kubernetes provider doesn't support build key - ignoring" convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/output-k8s.json" "Kubernetes provider doesn't support build key - ignoring"
# openshift test # openshift test
convert::expect_success_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/output-os.json" "Buildconfig using https://github.com/kubernetes-incubator/kompose.git::master as source." convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ngnix-node-redis/output-os.json" "Buildconfig using https://github.com/kubernetes-incubator/kompose.git::HEAD as source."
###### ######
# Tests related to docker-compose file in /script/test/fixtures/entrypoint-command # Tests related to docker-compose file in /script/test/fixtures/entrypoint-command
@ -92,7 +92,7 @@ convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_RO
###### ######
# Tests related to docker-compose file in /script/test/fixtures/envvars-separators # Tests related to docker-compose file in /script/test/fixtures/envvars-separators
# kubernetes test # kubernetes test
convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s.json" convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s.json" "Unsupported volume_driver key - ignoring"
###### ######
# Tests related to unknown arguments with cli commands # Tests related to unknown arguments with cli commands
@ -121,10 +121,10 @@ convert::expect_success_and_warning "kompose --bundle $KOMPOSE_ROOT/script/test/
# Test related to restart options in docker-compose # Test related to restart options in docker-compose
# kubernetes test # kubernetes test
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-no.json" convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-no.json"
convert::failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml convert --stdout -j" "Controller object cannot be specified with restart: 'on-failure'" convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-onfail.json"
# openshift test # openshift test
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml --provider openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-no.json" convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml --provider openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-no.json"
convert::failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml --provider openshift convert --stdout -j" "Controller object cannot be specified with restart: 'on-failure'" convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml --provider openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-onfail.json"
###### ######

View File

@ -3,32 +3,6 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": {}, "metadata": {},
"items": [ "items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "nginx"
}
},
"spec": {
"ports": [
{
"name": "80",
"port": 80,
"targetPort": 80
}
],
"selector": {
"io.kompose.service": "nginx"
}
},
"status": {
"loadBalancer": {}
}
},
{ {
"kind": "Service", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
@ -134,121 +108,29 @@
} }
}, },
{ {
"kind": "DeploymentConfig", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "nginx", "name": "nginx",
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"nginx"
],
"from": {
"kind": "ImageStreamTag",
"name": "nginx:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "nginx"
},
"template": {
"metadata": {
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"io.kompose.service": "nginx" "io.kompose.service": "nginx"
} }
}, },
"spec": { "spec": {
"containers": [
{
"name": "nginx",
"image": " ",
"ports": [ "ports": [
{ {
"containerPort": 80 "name": "80",
"port": 80,
"targetPort": 80
} }
], ],
"resources": {} "selector": {
"io.kompose.service": "nginx"
} }
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null
},
"spec": {},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null
},
"spec": {
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange"
}
],
"runPolicy": "Serial",
"source": {
"type": "Git",
"git": {
"uri": "git@github.com:procrypt/kompose.git",
"ref": "empty_vols"
},
"contextDir": "script/test/fixtures/ngnix-node-redis/nginx"
},
"strategy": {
"type": "Docker",
"dockerStrategy": {}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "nginx:latest"
}
},
"resources": {},
"postCommit": {},
"nodeSelector": null
}, },
"status": { "status": {
"lastVersion": 0 "loadBalancer": {}
} }
}, },
{ {
@ -258,7 +140,7 @@
"name": "node1", "name": "node1",
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"service": "node1" "io.kompose.service": "node1"
} }
}, },
"spec": { "spec": {
@ -286,7 +168,7 @@
"replicas": 1, "replicas": 1,
"test": false, "test": false,
"selector": { "selector": {
"service": "node1" "io.kompose.service": "node1"
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -319,7 +201,10 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "node1", "name": "node1",
"creationTimestamp": null "creationTimestamp": null,
"labels": {
"io.kompose.service": "node1"
}
}, },
"spec": {}, "spec": {},
"status": { "status": {
@ -346,8 +231,8 @@
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "git@github.com:procrypt/kompose.git", "uri": "https://github.com/kubernetes-incubator/kompose.git",
"ref": "empty_vols" "ref": "HEAD"
}, },
"contextDir": "script/test/fixtures/ngnix-node-redis/node" "contextDir": "script/test/fixtures/ngnix-node-redis/node"
}, },
@ -376,7 +261,7 @@
"name": "node2", "name": "node2",
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"service": "node2" "io.kompose.service": "node2"
} }
}, },
"spec": { "spec": {
@ -404,7 +289,7 @@
"replicas": 1, "replicas": 1,
"test": false, "test": false,
"selector": { "selector": {
"service": "node2" "io.kompose.service": "node2"
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -437,7 +322,10 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "node2", "name": "node2",
"creationTimestamp": null "creationTimestamp": null,
"labels": {
"io.kompose.service": "node2"
}
}, },
"spec": {}, "spec": {},
"status": { "status": {
@ -464,8 +352,8 @@
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "git@github.com:procrypt/kompose.git", "uri": "https://github.com/kubernetes-incubator/kompose.git",
"ref": "empty_vols" "ref": "HEAD"
}, },
"contextDir": "script/test/fixtures/ngnix-node-redis/node" "contextDir": "script/test/fixtures/ngnix-node-redis/node"
}, },
@ -494,7 +382,7 @@
"name": "node3", "name": "node3",
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"service": "node3" "io.kompose.service": "node3"
} }
}, },
"spec": { "spec": {
@ -522,7 +410,7 @@
"replicas": 1, "replicas": 1,
"test": false, "test": false,
"selector": { "selector": {
"service": "node3" "io.kompose.service": "node3"
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -555,7 +443,10 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "node3", "name": "node3",
"creationTimestamp": null "creationTimestamp": null,
"labels": {
"io.kompose.service": "node3"
}
}, },
"spec": {}, "spec": {},
"status": { "status": {
@ -582,8 +473,8 @@
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "git@github.com:procrypt/kompose.git", "uri": "https://github.com/kubernetes-incubator/kompose.git",
"ref": "empty_vols" "ref": "HEAD"
}, },
"contextDir": "script/test/fixtures/ngnix-node-redis/node" "contextDir": "script/test/fixtures/ngnix-node-redis/node"
}, },
@ -612,7 +503,7 @@
"name": "redis", "name": "redis",
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"service": "redis" "io.kompose.service": "redis"
} }
}, },
"spec": { "spec": {
@ -640,7 +531,7 @@
"replicas": 1, "replicas": 1,
"test": false, "test": false,
"selector": { "selector": {
"service": "redis" "io.kompose.service": "redis"
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -673,7 +564,10 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "redis", "name": "redis",
"creationTimestamp": null "creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
}, },
"spec": { "spec": {
"tags": [ "tags": [
@ -692,6 +586,127 @@
"status": { "status": {
"dockerImageRepository": "" "dockerImageRepository": ""
} }
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "nginx"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"nginx"
],
"from": {
"kind": "ImageStreamTag",
"name": "nginx:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"io.kompose.service": "nginx"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "nginx"
}
},
"spec": {
"containers": [
{
"name": "nginx",
"image": " ",
"ports": [
{
"containerPort": 80
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "nginx"
}
},
"spec": {},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null
},
"spec": {
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange"
}
],
"runPolicy": "Serial",
"source": {
"type": "Git",
"git": {
"uri": "https://github.com/kubernetes-incubator/kompose.git",
"ref": "HEAD"
},
"contextDir": "script/test/fixtures/ngnix-node-redis/nginx"
},
"strategy": {
"type": "Docker",
"dockerStrategy": {}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "nginx:latest"
}
},
"resources": {},
"postCommit": {},
"nodeSelector": null
},
"status": {
"lastVersion": 0
}
} }
] ]
} }

View File

@ -0,0 +1,36 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "foo",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "foo"
}
},
"spec": {
"containers": [
{
"name": "foo",
"image": "foobar",
"env": [
{
"name": "GITHUB",
"value": "surajssd"
}
],
"resources": {}
}
],
"restartPolicy": "OnFailure"
},
"status": {}
}
]
}

View File

@ -10,7 +10,7 @@
"name": "foo", "name": "foo",
"creationTimestamp": null, "creationTimestamp": null,
"labels": { "labels": {
"service": "foo" "io.kompose.service": "foo"
} }
}, },
"spec": { "spec": {