deployments-k8s
deployments-k8s copied to clipboard
`for loop` in bash commands can return false positive results
Description
gotestmd uses the exit code of the last run command.
We use for loop
for some tests. But the status of the loop is the status of the last command that executes inside this loop.
For example:
for {
operation1
...
operationN
}
If operation1
returns false
, but operationN
returns true
then $?
also returns true
. And gotestmd
bash
won't see the error.
Possible solution
We can use a subshell for for
cycles