-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves issue #870 for example, ``` $ cat docker-compose.yaml | kompose convert -f - INFO Kubernetes file "frontend-service.yaml" created INFO Kubernetes file "redis-master-service.yaml" created INFO Kubernetes file "redis-slave-service.yaml" created INFO Kubernetes file "frontend-deployment.yaml" created INFO Kubernetes file "redis-master-deployment.yaml" created INFO Kubernetes file "redis-slave-deployment.yaml" created ``` Added integration test for the same. `
- Loading branch information
1 parent
e4adfef
commit 02da34b
Showing
6 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"os/exec" | ||
"testing" | ||
) | ||
|
||
var Fixtures = os.ExpandEnv("$GOPATH/src/github.com/kubernetes/kompose/script/test/fixtures/") | ||
var ProjectPath = "$GOPATH/src/github.com/kubernetes/kompose/" | ||
var BinaryLocation = os.ExpandEnv(ProjectPath + "kompose") | ||
|
||
func Test_stdin(t *testing.T) { | ||
|
||
kjson := `{"version": "2","services": {"redis": {"image": "redis:3.0","ports": ["6379"]}}}` | ||
cmdStr := fmt.Sprintf("%s convert --stdout -f - <<EOF\n%s\nEOF\n", BinaryLocation, kjson) | ||
subproc := exec.Command("/bin/sh", "-c", cmdStr) | ||
output, err := subproc.Output() | ||
if err != nil { | ||
fmt.Println("error", err) | ||
} | ||
g, err := ioutil.ReadFile(Fixtures + "stdin/output.yml") | ||
if !bytes.Equal(output, g) { | ||
t.Errorf("Test Failed") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
apiVersion: v1 | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
kompose.cmd: /home/snarwade/go/src/github.com/kubernetes/kompose/kompose convert | ||
--stdout -f - | ||
kompose.version: 1.6.0 (HEAD) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: redis | ||
name: redis | ||
spec: | ||
ports: | ||
- name: "6379" | ||
port: 6379 | ||
targetPort: 6379 | ||
selector: | ||
io.kompose.service: redis | ||
status: | ||
loadBalancer: {} | ||
- apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
kompose.cmd: /home/snarwade/go/src/github.com/kubernetes/kompose/kompose convert | ||
--stdout -f - | ||
kompose.version: 1.6.0 (HEAD) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: redis | ||
name: redis | ||
spec: | ||
replicas: 1 | ||
strategy: {} | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: redis | ||
spec: | ||
containers: | ||
- image: redis:3.0 | ||
name: redis | ||
ports: | ||
- containerPort: 6379 | ||
resources: {} | ||
restartPolicy: Always | ||
status: {} | ||
kind: List | ||
metadata: {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters