mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
ci: execCommandInDaemonsetPod should not return unused stdout
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
5c1584671e
commit
782f08e2f0
@ -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",
|
"umount /var/lib/kubelet/pods/%s/volumes/kubernetes.io~csi/%s/mount",
|
||||||
pod.UID,
|
pod.UID,
|
||||||
pvc.Spec.VolumeName)
|
pvc.Spec.VolumeName)
|
||||||
_, stdErr, err := execCommandInDaemonsetPod(
|
stdErr, err := execCommandInDaemonsetPod(
|
||||||
f,
|
f,
|
||||||
cmd,
|
cmd,
|
||||||
cephFSDeamonSetName,
|
cephFSDeamonSetName,
|
||||||
|
17
e2e/pod.go
17
e2e/pod.go
@ -137,13 +137,16 @@ func getCommandInPodOpts(
|
|||||||
}, nil
|
}, 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(
|
func execCommandInDaemonsetPod(
|
||||||
f *framework.Framework,
|
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)
|
selector, err := getDaemonSetLabelSelector(f, ns, daemonsetName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
opt := &metav1.ListOptions{
|
opt := &metav1.ListOptions{
|
||||||
@ -151,7 +154,7 @@ func execCommandInDaemonsetPod(
|
|||||||
}
|
}
|
||||||
pods, err := listPods(f, ns, opt)
|
pods, err := listPods(f, ns, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
podName := ""
|
podName := ""
|
||||||
@ -161,7 +164,7 @@ func execCommandInDaemonsetPod(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if podName == "" {
|
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}
|
cmd := []string{"/bin/sh", "-c", c}
|
||||||
@ -174,7 +177,9 @@ func execCommandInDaemonsetPod(
|
|||||||
CaptureStderr: true,
|
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.
|
// listPods returns slice of pods matching given ListOptions and namespace.
|
||||||
|
Loading…
Reference in New Issue
Block a user