diff --git a/e2e/cephfs_helper.go b/e2e/cephfs_helper.go index db7811dd9..fb247ee01 100644 --- a/e2e/cephfs_helper.go +++ b/e2e/cephfs_helper.go @@ -154,7 +154,7 @@ func unmountCephFSVolume(f *framework.Framework, appName, pvcName string) error "umount /var/lib/kubelet/pods/%s/volumes/kubernetes.io~csi/%s/mount", pod.UID, pvc.Spec.VolumeName) - _, stdErr, err := execCommandInDaemonsetPod( + stdErr, err := execCommandInDaemonsetPod( f, cmd, cephFSDeamonSetName, diff --git a/e2e/pod.go b/e2e/pod.go index 394b92a18..61fb03db8 100644 --- a/e2e/pod.go +++ b/e2e/pod.go @@ -137,13 +137,16 @@ func getCommandInPodOpts( }, nil } -// execCommandInDaemonsetPod executes commands inside given container of a daemonset pod on a particular node. +// execCommandInDaemonsetPod executes commands inside given container of a +// daemonset pod on a particular node. +// +// stderr is returned as a string, and err will be set on a failure. func execCommandInDaemonsetPod( f *framework.Framework, - c, daemonsetName, nodeName, containerName, ns string) (string, string, error) { + c, daemonsetName, nodeName, containerName, ns string) (string, error) { selector, err := getDaemonSetLabelSelector(f, ns, daemonsetName) if err != nil { - return "", "", err + return "", err } opt := &metav1.ListOptions{ @@ -151,7 +154,7 @@ func execCommandInDaemonsetPod( } pods, err := listPods(f, ns, opt) if err != nil { - return "", "", err + return "", err } podName := "" @@ -161,7 +164,7 @@ func execCommandInDaemonsetPod( } } if podName == "" { - return "", "", fmt.Errorf("%s daemonset pod on node %s in namespace %s not found", daemonsetName, nodeName, ns) + return "", fmt.Errorf("%s daemonset pod on node %s in namespace %s not found", daemonsetName, nodeName, ns) } cmd := []string{"/bin/sh", "-c", c} @@ -174,7 +177,9 @@ func execCommandInDaemonsetPod( CaptureStderr: true, } - return f.ExecWithOptions(podOpt) + _ /* stdout */, stderr, err := f.ExecWithOptions(podOpt) + + return stderr, err } // listPods returns slice of pods matching given ListOptions and namespace.