Skip to content

Commit

Permalink
functional tests in golang
Browse files Browse the repository at this point in the history
This is the work I had done last week for writing functional test in golang. Here I am providing the `output.json` file to `ioutil.ReadFile` and then comparing it with the stdout of `kompose convert`.
  • Loading branch information
procrypt committed May 8, 2017
1 parent ae4ef9e commit f973b17
Show file tree
Hide file tree
Showing 100 changed files with 12,701 additions and 2 deletions.
25 changes: 25 additions & 0 deletions script/test/cmd/fixtures/bundles/dab/docker-compose-bundle.dab
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"services": {
"redis": {
"Image": "redis@sha256:561a224089a0c9a59de16bd596403010b42f417ef7c17142e9b64d7524e97beb",
"Networks": [],
"Ports": [
{
"Port": 6379,
"Protocol": "tcp"
}
]
},
"web": {
"Image": "tuna/docker-counter23@sha256:c6755a375f5eda203c35940cbd05625517207efca4015e6a4a2c6fdef08cf5ed",
"Networks": [],
"Ports": [
{
"Port": 5000,
"Protocol": "tcp"
}
]
}
},
"version": "0.1"
}
131 changes: 131 additions & 0 deletions script/test/cmd/fixtures/bundles/dab/output-k8s.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"ports": [
{
"name": "6379",
"port": 6379,
"targetPort": 6379
}
],
"selector": {
"io.kompose.service": "redis"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"ports": [
{
"name": "5000",
"port": 5000,
"targetPort": 5000
}
],
"selector": {
"io.kompose.service": "web"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": "redis",
"ports": [
{
"containerPort": 6379
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "web",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"containers": [
{
"name": "web",
"image": "tuna/docker-counter23",
"ports": [
{
"containerPort": 5000
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}
65 changes: 65 additions & 0 deletions script/test/cmd/fixtures/bundles/dsb/docker-voting-bundle.dsb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"Services": {
"db": {
"Image": "postgres@sha256:33632bbd3222fa738d80a267b7c706a15d76eb3a59facab94bbd52a69cd1e30c",
"Labels": {
"com.example.description": "Postgres Database"
},
"Networks": [
"default"
],
"Ports": [
{
"Port": 5432,
"Protocol": "tcp"
}
]
},
"redis": {
"Image": "redis@sha256:afa4e7f6dc4d4f4294f54835bcfe610201057f5424b36310cba799e625849ebd",
"Networks": [
"default"
],
"Ports": [
{
"Port": 6379,
"Protocol": "tcp"
}
]
},
"result": {
"Image": "tmadams333/example-voting-app-result@sha256:97d6ba26e5ffa35a89a3d97627fa3c8a3b0b3df8e708129eabcf9f2755e06d13",
"Networks": [
"default"
],
"Ports": [
{
"Port": 80,
"Protocol": "tcp"
}
]
},
"vote": {
"Image": "docker/example-voting-app-vote@sha256:33f7924f9aaabd2aacf3f59a9c98e372360213ec94cb35f60842502632ec2f74",
"Labels": {
"com.example.description": "Vote"
},
"Networks": [
"default"
],
"Ports": [
{
"Port": 80,
"Protocol": "tcp"
}
]
},
"worker": {
"Image": "docker/example-voting-app-worker@sha256:62cbf0976fc66192d19412135fc422bfaaed5987a8ae405ff4d1968f1b714f24",
"Networks": [
"default"
]
}
},
"Version": "0.1"
}

0 comments on commit f973b17

Please sign in to comment.