Skip to content

Commit 3c3c5e2

Browse files
piyush-gargtekton-robot
authored andcommitted
Refactoring in sidecar test
It will now run as parallel and also will create a nmespace Use simple busybox image
1 parent ee887b2 commit 3c3c5e2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/sidecar_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
2727
corev1 "k8s.io/api/core/v1"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29+
knativetest "knative.dev/pkg/test"
2930
)
3031

3132
const (
@@ -54,6 +55,10 @@ func TestSidecarTaskSupport(t *testing.T) {
5455
}}
5556

5657
clients, namespace := setup(t)
58+
t.Parallel()
59+
60+
knativetest.CleanupOnInterrupt(func() { tearDown(t, clients, namespace) }, t.Logf)
61+
defer tearDown(t, clients, namespace)
5762

5863
for i, test := range tests {
5964
t.Run(test.desc, func(t *testing.T) {
@@ -63,10 +68,10 @@ func TestSidecarTaskSupport(t *testing.T) {
6368
ObjectMeta: metav1.ObjectMeta{Name: sidecarTaskName, Namespace: namespace},
6469
Spec: v1beta1.TaskSpec{
6570
Steps: []v1beta1.Step{{
66-
Container: corev1.Container{Name: primaryContainerName, Image: "busybox:1.31.0-musl", Command: test.stepCommand},
71+
Container: corev1.Container{Name: primaryContainerName, Image: "busybox", Command: test.stepCommand},
6772
}},
6873
Sidecars: []v1beta1.Sidecar{{
69-
Container: corev1.Container{Name: sidecarContainerName, Image: "busybox:1.31.0-musl", Command: test.sidecarCommand},
74+
Container: corev1.Container{Name: sidecarContainerName, Image: "busybox", Command: test.sidecarCommand},
7075
}},
7176
},
7277
}

test/v1alpha1/sidecar_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
tb "github.com/tektoncd/pipeline/internal/builder/v1alpha1"
2727
corev1 "k8s.io/api/core/v1"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29+
knativetest "knative.dev/pkg/test"
2930
)
3031

3132
const (
@@ -54,6 +55,10 @@ func TestSidecarTaskSupport(t *testing.T) {
5455
}}
5556

5657
clients, namespace := setup(t)
58+
t.Parallel()
59+
60+
knativetest.CleanupOnInterrupt(func() { tearDown(t, clients, namespace) }, t.Logf)
61+
defer tearDown(t, clients, namespace)
5762

5863
for i, test := range tests {
5964
t.Run(test.desc, func(t *testing.T) {
@@ -62,13 +67,13 @@ func TestSidecarTaskSupport(t *testing.T) {
6267
task := tb.Task(sidecarTaskName,
6368
tb.TaskSpec(
6469
tb.Step(
65-
"busybox:1.31.0-musl",
70+
"busybox",
6671
tb.StepName(primaryContainerName),
6772
tb.StepCommand(test.stepCommand...),
6873
),
6974
tb.Sidecar(
7075
sidecarContainerName,
71-
"busybox:1.31.0-musl",
76+
"busybox",
7277
tb.Command(test.sidecarCommand...),
7378
),
7479
),

0 commit comments

Comments
 (0)