Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Feb 7, 2019
1 parent 9b8195a commit af1db5c
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 2 deletions.
14 changes: 12 additions & 2 deletions integration/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func TestRun(t *testing.T) {
args: []string{"-p", "gcb"},
pods: []string{"getting-started"},
remoteOnly: true,
}, {
description: "Google Cloud Build - sub folder",
dir: "testdata/gcb-sub-folder",
pods: []string{"getting-started"},
remoteOnly: true,
}, {
description: "kaniko",
dir: "examples/kaniko",
Expand All @@ -129,6 +134,11 @@ func TestRun(t *testing.T) {
dir: "examples/kaniko-local",
pods: []string{"getting-started-kaniko"},
remoteOnly: true,
}, {
description: "kaniko local - sub folder",
dir: "testdata/kaniko-sub-folder",
pods: []string{"getting-started-kaniko"},
remoteOnly: true,
}, {
description: "helm",
dir: "examples/helm-deployment",
Expand Down Expand Up @@ -294,14 +304,14 @@ func TestFix(t *testing.T) {
defer deleteNs()

fixCmd := exec.Command("skaffold", "fix", "-f", "skaffold.yaml")
fixCmd.Dir = "testdata"
fixCmd.Dir = "testdata/fix"
out, err := util.RunCmdOut(fixCmd)
if err != nil {
t.Fatalf("testing error: %v", err)
}

runCmd := exec.Command("skaffold", "run", "--namespace", ns.Name, "-f", "-")
runCmd.Dir = "testdata"
runCmd.Dir = "testdata/fix"
runCmd.Stdin = bytes.NewReader(out)
err = util.RunCmd(runCmd)
if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions integration/testdata/gcb-sub-folder/k8s/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: getting-started
spec:
containers:
- name: getting-started
image: gcr.io/k8s-skaffold/skaffold-example-sub
7 changes: 7 additions & 0 deletions integration/testdata/gcb-sub-folder/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: skaffold/v1beta4
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/skaffold-example-sub
context: sub
googleCloudBuild: {}
7 changes: 7 additions & 0 deletions integration/testdata/gcb-sub-folder/sub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.10.1-alpine3.7 as builder
COPY main.go .
RUN go build -o /app main.go

FROM alpine:3.7
CMD ["./app"]
COPY --from=builder /app .
14 changes: 14 additions & 0 deletions integration/testdata/gcb-sub-folder/sub/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("Hello world!")

time.Sleep(time.Second * 1)
}
}
8 changes: 8 additions & 0 deletions integration/testdata/kaniko-sub-folder/k8s/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: getting-started-kaniko
spec:
containers:
- name: getting-started
image: gcr.io/k8s-skaffold/skaffold-example-sub
10 changes: 10 additions & 0 deletions integration/testdata/kaniko-sub-folder/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: skaffold/v1beta4
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/skaffold-example-sub
context: sub
kaniko:
buildContext:
localDir: {}
pullSecretName: e2esecret
6 changes: 6 additions & 0 deletions integration/testdata/kaniko-sub-folder/sub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/google-appengine/golang

WORKDIR /go/src/github.com/GoogleCloudPlatform/skaffold
CMD ["./app"]
COPY main.go .
RUN go build -o app main.go
13 changes: 13 additions & 0 deletions integration/testdata/kaniko-sub-folder/sub/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("Hello world!")
time.Sleep(time.Second * 1)
}
}

0 comments on commit af1db5c

Please sign in to comment.