You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, build/unit-in-container.sh never ran any tests under cmd.
This happened because the $(go list ...) in BUILD_CMD was not escaped,
and therefore the expansion happened before cd. Here is a demo:
[kir@kir-rhat cadvisor]$ BUILD_CMD="pwd && cd cmd && echo $(pwd)"
[kir@kir-rhat cadvisor]$ echo $BUILD_CMD
pwd && cd cmd && echo /home/kir/go/src/github.com/google/cadvisor
The fix would be to escape the $ in $(go list):
[kir@kir-rhat cadvisor]$ BUILD_CMD="pwd && cd cmd && echo \$(pwd)"
[kir@kir-rhat cadvisor]$ echo $BUILD_CMD
pwd && cd cmd && echo $(pwd)
[kir@kir-rhat cadvisor]$ sh -c "$BUILD_CMD"
/home/kir/go/src/github.com/google/cadvisor
/home/kir/go/src/github.com/google/cadvisor/cmd
Yet, it's easier just to reuse the make test target which already has
the exclusion logic. For that to work properly with custom test configs
from ./build/config, we need to export GO_FLAGS env var into container.
While at it, slightly simplify the BUILD_CMD by adding -e to bash, so we
do not have to specify && every time.
Fixes: 74b513b
Signed-off-by: Kir Kolyshkin <[email protected]>
0 commit comments