Skip to content

Commit

Permalink
add testcase for namespace parameter to input_resource_test
Browse files Browse the repository at this point in the history
Signed-off-by: cappyzawa <cappyzawa@yahoo.ne.jp>
  • Loading branch information
cappyzawa committed Sep 4, 2019
1 parent 716daf5 commit fe92e4d
Showing 1 changed file with 70 additions and 4 deletions.
74 changes: 70 additions & 4 deletions pkg/reconciler/taskrun/resources/input_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,35 @@ func setUp(t *testing.T) {
}, {
Name: "Url",
Value: "http://10.10.10.10",
},
{
Name: "CAdata",
// echo "my-ca-cert" | base64
Value: "bXktY2EtY2VydAo=",
}},
},
}, {
ObjectMeta: metav1.ObjectMeta{
Name: "cluster4",
Namespace: "marshmallow",
},
Spec: v1alpha1.PipelineResourceSpec{
Type: "cluster",
Params: []v1alpha1.ResourceParam{{
Name: "name",
Value: "cluster4",
}, {
Name: "CAdata",
// echo "my-ca-cert" | base64
Value: "bXktY2EtY2VydAo=",
}},
Name: "Url",
Value: "http://10.10.10.10",
},
{
Name: "Namespace",
Value: "namespace1",
}, {
Name: "CAdata",
// echo "my-ca-cert" | base64
Value: "bXktY2EtY2VydAo=",
}},
},
}, {
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -643,6 +667,48 @@ func TestAddResourceToTask(t *testing.T) {
},
}}},
},
}, {
desc: "cluster resource with namespace",
task: &v1alpha1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "build-from-repo",
Namespace: "marshmallow",
},
Spec: v1alpha1.TaskSpec{
Inputs: clusterInputs,
},
},
taskRun: &v1alpha1.TaskRun{
ObjectMeta: metav1.ObjectMeta{
Name: "build-from-repo-run",
Namespace: "marshmallow",
},
Spec: v1alpha1.TaskRunSpec{
TaskRef: &v1alpha1.TaskRef{
Name: "build-from-repo",
},
Inputs: v1alpha1.TaskRunInputs{
Resources: []v1alpha1.TaskResourceBinding{{
Name: "target-cluster",
ResourceRef: v1alpha1.PipelineResourceRef{
Name: "cluster4",
},
}},
},
},
},
wantErr: false,
want: &v1alpha1.TaskSpec{
Inputs: clusterInputs,
Steps: []v1alpha1.Step{{Container: corev1.Container{
Name: "kubeconfig-9l9zj",
Image: "override-with-kubeconfig-writer:latest",
Command: []string{"/ko-app/kubeconfigwriter"},
Args: []string{
"-clusterConfig", `{"name":"cluster4","type":"cluster","url":"http://10.10.10.10","revision":"","username":"","password":"","namespace":"namespace1","token":"","Insecure":false,"cadata":"bXktY2EtY2VydAo=","secrets":null}`,
},
}}},
},
}, {
desc: "cluster resource with secrets",
task: &v1alpha1.Task{
Expand Down

0 comments on commit fe92e4d

Please sign in to comment.