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

test/sidecar_test.go: replace t.Errorfs with t.Fatalfs #4436

Merged
merged 1 commit into from
Jan 4, 2022
Merged
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
15 changes: 8 additions & 7 deletions test/sidecar_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

/*
Expand Down Expand Up @@ -102,21 +103,21 @@ spec:

t.Logf("Creating Task %q", sidecarTaskName)
if _, err := clients.TaskClient.Create(ctx, task, metav1.CreateOptions{}); err != nil {
t.Errorf("Failed to create Task %q: %v", sidecarTaskName, err)
t.Fatalf("Failed to create Task %q: %v", sidecarTaskName, err)
}

t.Logf("Creating TaskRun %q", sidecarTaskRunName)
if _, err := clients.TaskRunClient.Create(ctx, taskRun, metav1.CreateOptions{}); err != nil {
t.Errorf("Failed to create TaskRun %q: %v", sidecarTaskRunName, err)
t.Fatalf("Failed to create TaskRun %q: %v", sidecarTaskRunName, err)
}

if err := WaitForTaskRunState(ctx, clients, sidecarTaskRunName, Succeed(sidecarTaskRunName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun %q to finish: %v", sidecarTaskRunName, err)
t.Fatalf("Error waiting for TaskRun %q to finish: %v", sidecarTaskRunName, err)
}

tr, err := clients.TaskRunClient.Get(ctx, sidecarTaskRunName, metav1.GetOptions{})
if err != nil {
t.Errorf("Error getting Taskrun: %v", err)
t.Fatalf("Error getting Taskrun: %v", err)
}
podName := tr.Status.PodName

Expand All @@ -129,12 +130,12 @@ spec:
}
return terminatedCount == 2, nil
}, "PodContainersTerminated"); err != nil {
t.Errorf("Error waiting for Pod %q to terminate both the primary and sidecar containers: %v", podName, err)
t.Fatalf("Error waiting for Pod %q to terminate both the primary and sidecar containers: %v", podName, err)
}

pod, err := clients.KubeClient.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
if err != nil {
t.Errorf("Error getting TaskRun pod: %v", err)
t.Fatalf("Error getting TaskRun pod: %v", err)
}

primaryTerminated := false
Expand Down Expand Up @@ -163,7 +164,7 @@ spec:

trCheckSidecarStatus, err := clients.TaskRunClient.Get(ctx, sidecarTaskRunName, metav1.GetOptions{})
if err != nil {
t.Errorf("Error getting TaskRun: %v", err)
t.Fatalf("Error getting TaskRun: %v", err)
}

sidecarFromStatus := trCheckSidecarStatus.Status.Sidecars[0]
Expand Down