Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
refactor: Add more documentation to the code
Browse files Browse the repository at this point in the history
Signed-off-by: Raphael Ludwig <[email protected]>
  • Loading branch information
Raffy23 committed May 2, 2022
1 parent ba8c65e commit 8332598
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions pkg/k8sutils/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
}

0 comments on commit 8332598

Please sign in to comment.