[bitnami/nats] Fix issue with goss tests 'running_user' (#18400)

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>
This commit is contained in:
Miguel Ruiz
2023-08-14 11:15:04 +02:00
committed by GitHub
parent 5f52e057ae
commit 5d4da454d6

View File

@@ -8,7 +8,6 @@ file:
exists: true
owner: root
command:
{{- $running_user := printf "%d" .Vars.containerSecurityContext.runAsUser }}
{{- $auth := printf "--user=%s --password=%s" .Vars.auth.user .Vars.auth.password }}
{{- $client_port := printf "%d" .Vars.service.ports.client }}
{{- $lb_endpoint := printf "-s nats://nats:%s" $client_port }}
@@ -18,7 +17,7 @@ command:
## We need to have the subscriber process running at the same time the publishing is done
## The sleep is needed to avoid a race condition where the publishing is done before the subscriber is ready
## The subscriber process needs to be timed out so there is no dangling process making goss timeout
exec: ( USER={{ $running_user }} timeout 10 ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} sub {{ $subject }}; ) & sleep 3 && USER={{ $running_user }} ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} pub {{ $subject }} {{ $msg }}
exec: ( USER=$(id -u) timeout 10 ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} sub {{ $subject }}; ) & sleep 3 && USER=$(id -u) ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} pub {{ $subject }} {{ $msg }}
exit-status: 0
stdout:
- /Received on.*{{ $subject }}/
@@ -29,7 +28,7 @@ command:
{{- $subject := printf "subj_%s" (randAlpha 5) }}
{{- $msg := printf "msg_%s" (randAlpha 5) }}
{{- $pod_endpoint := printf "-s nats://nats-%d.nats-headless:%s" $i $client_port }}
exec: ( USER={{ $running_user }} timeout 10 ./nats/goss/testfiles/nats {{ $auth }} {{ $pod_endpoint }} sub {{ $subject }}; ) & sleep 3 && USER={{ $running_user }} ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} pub {{ $subject }} {{ $msg }}
exec: ( USER=$(id -u) timeout 10 ./nats/goss/testfiles/nats {{ $auth }} {{ $pod_endpoint }} sub {{ $subject }}; ) & sleep 3 && USER=$(id -u) ./nats/goss/testfiles/nats {{ $auth }} {{ $lb_endpoint }} pub {{ $subject }} {{ $msg }}
exit-status: 0
stdout:
- /Received on.*{{ $subject }}/