#!/bin/bash

source "$(dirname "${BASH_SOURCE}")/init.sh"

# Check for `go` binary and set ${GOPATH}.
setup_env

pushd ${GOPATH}/src/${OVN_KUBE_GO_PACKAGE}

if [ -z "$PKGS" ]; then
  # by default, test everything that's not in vendor
  PKGS="$(go list ./... | grep -v vendor | xargs echo)"
fi

# Work around sudo's PATH handling since Travis puts in Go in the travis user's homedir
GO=`which go`
# sudo is required because some testcases manipulate network namespaces
sudo -E bash -c "umask 0; CGO_ENABLED=0 ${GO} test "${goflags[@]:+${goflags[@]}}" ${PKGS}"

popd

#!/bin/bash

source "$(dirname "${BASH_SOURCE}")/init.sh"

# Check for `go` binary and set ${GOPATH}.
setup_env

pushd ${GOPATH}/src/${OVN_KUBE_GO_PACKAGE}

if [ -z "$PKGS" ]; then
  # by default, test everything that's not in vendor
  PKGS="$(go list ./... | grep -v vendor | xargs echo)"
fi

# Work around sudo's PATH handling since Travis puts in Go in the travis user's homedir
GO=`which go`
# sudo is required because some testcases manipulate network namespaces
sudo -E bash -c "umask 0; CGO_ENABLED=0 ${GO} test "${goflags[@]:+${goflags[@]}}" ${PKGS}"
retcode=$?

popd
exit $retcode

Return proper exit code for make check
Return proper exit code for make check

In the test-go.sh the last command is popd which will be the exit
code of the script. This means that even if running the actual tests
will fail, the exit code of the script will always be 0.

This change will also fix travis ci to fail when tests are failing.

Signed-off-by: Alin-Gheorghe Balutoiu <f2a0cbdab18961c268084fbb0aee7ec62cb0dabb@gmail.com>
