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>
(cherry picked from commit 693aabbe1e)
This commit is contained in:
Niels de Vos 2022-02-03 08:17:47 +01:00 committed by mergify[bot]
parent 014ab47a57
commit f0db85daa9

View File

@ -1266,11 +1266,11 @@ var _ = Describe("RBD", func() {
var runningAttachCmd string
runningAttachCmd, stdErr, err = execCommandInContainer(
f,
"ps -eo 'cmd' | grep [r]bd-nbd",
"pstree --arguments | grep [r]bd-nbd",
cephCSINamespace,
"csi-rbdplugin",
&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
if err != nil {
if strings.Contains(err.Error(), "command terminated with exit code 1") {