Skip to content

Commit

Permalink
GetPodLogs returns logs of a Pod if it is running
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobcrawford committed Jan 21, 2023
1 parent dc75863 commit aefcdbf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/k8s/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,18 @@ func IsPodAvailable(pod *corev1.Pod) bool {
return pod.Status.Phase == corev1.PodRunning
}

// GetPodLogsE returns the logs of a Pod at the time when the function was called. If the Pod is not running an Error is returned.
func GetPodLogsE(t testing.TestingT, options *KubectlOptions, pod *corev1.Pod) (string, error) {
output, err := RunKubectlAndGetOutputE(t, options, "logs", pod.Name)
if err != nil {
return "", err
}
return output, nil
}

// GetPodLogsE returns the logs of a Pod at the time when the function was called.
func GetPodLogs(t testing.TestingT, options *KubectlOptions, pod *corev1.Pod) string {
return ""
logs, err := GetPodLogsE(t, options, pod)
require.NoError(t, err)
return logs
}

0 comments on commit aefcdbf

Please sign in to comment.