From 833259879d14c19b0b40d7ca2d0b7b278496cc01 Mon Sep 17 00:00:00 2001 From: Raphael Ludwig Date: Fri, 22 Apr 2022 11:19:28 +0200 Subject: [PATCH] refactor: Add more documentation to the code Signed-off-by: Raphael Ludwig --- pkg/k8sutils/pod_test.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pkg/k8sutils/pod_test.go b/pkg/k8sutils/pod_test.go index b0749e1a..9dfc2e31 100644 --- a/pkg/k8sutils/pod_test.go +++ b/pkg/k8sutils/pod_test.go @@ -124,10 +124,10 @@ func TestGetLogsOfPodHappyPath(t *testing.T) { logsOfPod, err := k8s.GetLogsOfPod(jobName, namespace) assert.NoError(t, err) - assert.Equal(t, logsOfPod, "fake logs") + assert.Contains(t, logsOfPod, "fake logs") // Assert that the fake received the call - getLogAction := k8stesting.GenericActionImpl{ + getLogActionInitContainer := k8stesting.GenericActionImpl{ ActionImpl: k8stesting.ActionImpl{ Namespace: namespace, Verb: "get", @@ -138,8 +138,27 @@ func TestGetLogsOfPodHappyPath(t *testing.T) { }, Subresource: "log", }, - Value: &v1.PodLogOptions{}, + Value: &v1.PodLogOptions{ + Container: initContainerName, + }, + } + + getLogActionContainer := k8stesting.GenericActionImpl{ + ActionImpl: k8stesting.ActionImpl{ + Namespace: namespace, + Verb: "get", + Resource: schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "pods", + }, + Subresource: "log", + }, + Value: &v1.PodLogOptions{ + Container: jobName, + }, } - assert.Contains(t, k8sClientSet.Actions(), getLogAction) + assert.Contains(t, k8sClientSet.Actions(), getLogActionInitContainer) + assert.Contains(t, k8sClientSet.Actions(), getLogActionContainer) }