mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
e2e: add func utils.GetFormattedErrorAndLog for logging failed pod
Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
This commit is contained in:
parent
00c666ac57
commit
4b26ead3ac
@ -17,6 +17,7 @@ package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -41,6 +42,16 @@ const (
|
||||
poll = time.Second
|
||||
)
|
||||
|
||||
// GetPodLogs returns the log of the container. If not possible to get logs, it returns the error message.
|
||||
func GetPodLogs(ctx context.Context, f *framework.Framework, podName, containerName string) string {
|
||||
log, err := e2epod.GetPodLogs(ctx, f.ClientSet, f.Namespace.Name, podName, containerName)
|
||||
if err != nil {
|
||||
return fmt.Sprintf("unable to get log from pod: %v", err)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("log output of the container %s in the pod %s:%s", containerName, podName, log)
|
||||
}
|
||||
|
||||
// WaitForNodesWithResource waits for nodes to have positive allocatable resource.
|
||||
func WaitForNodesWithResource(ctx context.Context, c clientset.Interface, res v1.ResourceName, timeout time.Duration) error {
|
||||
framework.Logf("Waiting up to %s for any positive allocatable resource %q", timeout, res)
|
||||
|
Loading…
Reference in New Issue
Block a user