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 --dry-run with --filename Tests for All Start Commands #937

Merged
merged 1 commit into from
Apr 27, 2020
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
16 changes: 0 additions & 16 deletions pkg/cmd/clustertask/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,22 +925,6 @@ func Test_ClusterTask_Start_v1beta1(t *testing.T) {
wantError: false,
goldenFile: true,
},
{
name: "Dry run with output=json",
command: []string{"start", "clustertask-2",
"-i", "my-repo=git",
"-o", "code-image=output-image",
"-l", "key=value",
"-s=svc1",
"--dry-run",
"--output=json",
},
dynamic: seeds[3].dynamicClient,
input: seeds[3].pipelineClient,
inputStream: nil,
wantError: false,
goldenFile: true,
},
{
name: "Dry run with no output v1beta1",
command: []string{"start", "clustertask-2",
Expand Down
24 changes: 4 additions & 20 deletions pkg/cmd/pipeline/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func TestPipelineStart_ExecuteCommand(t *testing.T) {
goldenFile: true,
},
{
name: "Dry Run using --filename",
name: "Dry Run using --filename v1alpha1",
command: []string{"start", "-f", "./testdata/pipeline-v1alpha1.yaml",
"-r=source-repo=scaffold-git",
"-r=web-image=imageres",
Expand All @@ -606,7 +606,7 @@ func TestPipelineStart_ExecuteCommand(t *testing.T) {
goldenFile: true,
},
{
name: "Dry Run with output=json -f",
name: "Dry Run with output=json -f v1alpha1",
command: []string{"start", "-f", "./testdata/pipeline-v1alpha1.yaml",
"-r=source-repo=scaffold-git",
"-r=web-image=imageres",
Expand Down Expand Up @@ -1209,23 +1209,7 @@ func TestPipelineV1beta1Start_ExecuteCommand(t *testing.T) {
want: "cannot use --last or --use-pipelinerun options with --use-param-defaults option",
},
{
name: "Dry Run with output=json",
command: []string{"start", "test-pipeline",
"-s=svc1",
"-r=source=scaffold-git",
"-p=pipeline-param=value1",
"-l=jemange=desfrites",
"-n", "ns",
"--dry-run",
"--output", "json",
},
namespace: "",
input: c2,
wantError: false,
goldenFile: true,
},
{
name: "Dry Run using --filename",
name: "Dry Run using --filename v1beta1",
command: []string{"start", "-f", "./testdata/pipeline-v1beta1.yaml",
"-r=source-repo=scaffold-git",
"-r=web-image=imageres",
Expand All @@ -1238,7 +1222,7 @@ func TestPipelineV1beta1Start_ExecuteCommand(t *testing.T) {
goldenFile: true,
},
{
name: "Dry Run with output=json -f",
name: "Dry Run with output=json -f v1beta1",
command: []string{"start", "-f", "./testdata/pipeline-v1beta1.yaml",
"-r=source-repo=scaffold-git",
"-r=web-image=imageres",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"kind": "PipelineRun",
"apiVersion": "tekton.dev/v1alpha1",
"metadata": {
"generateName": "test-pipeline-run-",
"namespace": "ns",
"creationTimestamp": null
},
"spec": {
"pipelineSpec": {
"resources": [
{
"name": "source-repo",
"type": "git"
},
{
"name": "web-image",
"type": "image"
}
],
"tasks": [
{
"name": "build-skaffold-web",
"taskRef": {
"name": "build-docker-image-from-git-source"
},
"resources": {
"inputs": [
{
"name": "docker-source",
"resource": "source-repo"
}
],
"outputs": [
{
"name": "builtImage",
"resource": "web-image"
}
]
},
"params": [
{
"name": "pathToDockerFile",
"value": "Dockerfile"
},
{
"name": "pathToContext",
"value": "/workspace/docker-source/examples/microservices/leeroy-web"
}
]
},
{
"name": "deploy-web",
"taskRef": {
"name": "deploy-using-kubectl"
},
"resources": {
"inputs": [
{
"name": "source",
"resource": "source-repo"
},
{
"name": "image",
"resource": "web-image",
"from": [
"build-skaffold-web"
]
}
]
},
"params": [
{
"name": "path",
"value": "/workspace/source/examples/microservices/leeroy-web/kubernetes/deployment.yaml"
},
{
"name": "yamlPathToImage",
"value": "spec.template.spec.containers[0].image"
}
]
}
]
},
"resources": [
{
"name": "source-repo",
"resourceRef": {
"name": "scaffold-git"
}
},
{
"name": "web-image",
"resourceRef": {
"name": "imageres"
}
}
]
},
"status": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
generateName: test-pipeline-run-
namespace: ns
spec:
pipelineSpec:
resources:
- name: source-repo
type: git
- name: web-image
type: image
tasks:
- name: build-skaffold-web
params:
- name: pathToDockerFile
value: Dockerfile
- name: pathToContext
value: /workspace/docker-source/examples/microservices/leeroy-web
resources:
inputs:
- name: docker-source
resource: source-repo
outputs:
- name: builtImage
resource: web-image
taskRef:
name: build-docker-image-from-git-source
- name: deploy-web
params:
- name: path
value: /workspace/source/examples/microservices/leeroy-web/kubernetes/deployment.yaml
- name: yamlPathToImage
value: spec.template.spec.containers[0].image
resources:
inputs:
- name: source
resource: source-repo
- from:
- build-skaffold-web
name: image
resource: web-image
taskRef:
name: deploy-using-kubectl
resources:
- name: source-repo
resourceRef:
name: scaffold-git
- name: web-image
resourceRef:
name: imageres
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"kind": "PipelineRun",
"apiVersion": "tekton.dev/v1beta1",
"metadata": {
"generateName": "test-pipeline-run-",
"namespace": "ns",
"creationTimestamp": null
},
"spec": {
"pipelineSpec": {
"resources": [
{
"name": "source-repo",
"type": "git"
},
{
"name": "web-image",
"type": "image"
}
],
"tasks": [
{
"name": "build-skaffold-web",
"taskRef": {
"name": "build-docker-image-from-git-source"
},
"resources": {
"inputs": [
{
"name": "docker-source",
"resource": "source-repo"
}
],
"outputs": [
{
"name": "builtImage",
"resource": "web-image"
}
]
},
"params": [
{
"name": "pathToDockerFile",
"value": "Dockerfile"
},
{
"name": "pathToContext",
"value": "/workspace/docker-source/examples/microservices/leeroy-web"
}
]
},
{
"name": "deploy-web",
"taskRef": {
"name": "deploy-using-kubectl"
},
"resources": {
"inputs": [
{
"name": "source",
"resource": "source-repo"
},
{
"name": "image",
"resource": "web-image",
"from": [
"build-skaffold-web"
]
}
]
},
"params": [
{
"name": "path",
"value": "/workspace/source/examples/microservices/leeroy-web/kubernetes/deployment.yaml"
},
{
"name": "yamlPathToImage",
"value": "spec.template.spec.containers[0].image"
}
]
}
]
},
"resources": [
{
"name": "source-repo",
"resourceRef": {
"name": "scaffold-git"
}
},
{
"name": "web-image",
"resourceRef": {
"name": "imageres"
}
}
]
},
"status": {}
}
21 changes: 3 additions & 18 deletions pkg/cmd/task/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3847,7 +3847,7 @@ func TestTaskStart_ExecuteCommand(t *testing.T) {
goldenFile: true,
},
{
name: "Dry Run with output=json -f",
name: "Dry Run with output=json -f v1alpha1",
command: []string{"start",
"-f", "./testdata/task-v1alpha1.yaml",
"-n", "ns",
Expand Down Expand Up @@ -4000,21 +4000,6 @@ func TestTaskStart_ExecuteCommand_v1beta1(t *testing.T) {
wantError: false,
goldenFile: true,
},
{
name: "Dry Run with output=json",
command: []string{"start", "task-1",
"-i=my-repo=git-repo",
"-o=code-image=output-image",
"-s=svc1",
"-n", "ns",
"--dry-run",
"--output=json"},
namespace: "",
dynamic: dc,
input: cs,
wantError: false,
goldenFile: true,
},
{
name: "Dry Run with -f v1beta1",
command: []string{"start",
Expand Down Expand Up @@ -4047,9 +4032,9 @@ func TestTaskStart_ExecuteCommand_v1beta1(t *testing.T) {
goldenFile: true,
},
{
name: "Dry Run with output=json -f",
name: "Dry Run with output=json -f v1beta1",
command: []string{"start",
"-f", "./testdata/task-v1alpha1.yaml",
"-f", "./testdata/task-v1beta1.yaml",
"-n", "ns",
"-s=svc1",
"-i=docker-source=git",
Expand Down
Loading