deployments-k8s icon indicating copy to clipboard operation
deployments-k8s copied to clipboard

`for loop` in bash commands can return false positive results

Open glazychev-art opened this issue 2 years ago • 0 comments

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

glazychev-art avatar Oct 17 '22 06:10 glazychev-art