e2e: use pstree instead of ps for checking rbd-nbd process

The CentOS Stream 8 base container image does not have `ps` installed.
This causes CI jobs to fail, when checking for a restarted rbd-nbd
process.

Instead of using `ps`, the `pstree` command can be used. This will add
some ASCII-tree symbols in front of the command that is logged by the
e2e tests, but that is only used for manual reviewing and does not harm
the running test.

Fixes: #2850
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2022-02-03 08:17:47 +01:00 committed by mergify[bot]
parent 13f1611396
commit 693aabbe1e

View File

@ -1265,11 +1265,11 @@ var _ = Describe("RBD", func() {
var runningAttachCmd string var runningAttachCmd string
runningAttachCmd, stdErr, err = execCommandInContainer( runningAttachCmd, stdErr, err = execCommandInContainer(
f, f,
"ps -eo 'cmd' | grep [r]bd-nbd", "pstree --arguments | grep [r]bd-nbd",
cephCSINamespace, cephCSINamespace,
"csi-rbdplugin", "csi-rbdplugin",
&opt) &opt)
// if the rbd-nbd process is not running the ps | grep command // if the rbd-nbd process is not running the 'grep' command
// will return with exit code 1 // will return with exit code 1
if err != nil { if err != nil {
if strings.Contains(err.Error(), "command terminated with exit code 1") { if strings.Contains(err.Error(), "command terminated with exit code 1") {