Skip to content

Commit 31ae521

Browse files
Jeff Peelerkibbles-n-bytes
Jeff Peeler
authored andcommitted
Check if file permissions allow go install (openshift#1566)
Currently the integration tests install package dependencies regardless of whether or not GOROOT permissions allow it. This change will check for write access on the appropriate directory and if write permissions aren't found, the -i flag is dropped. Since there could be a scenario where one wants to install the dependencies and has a non-writable GOROOT, the environment variable PKGDIR can be defined in that case.
1 parent 52e64db commit 31ae521

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/integration.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,20 @@ set -o pipefail
2121
# this script resides in the `test/` folder at the root of the project
2222
KUBE_ROOT=$(realpath $(dirname "${BASH_SOURCE}")/../pkg/kubernetes)
2323
source "${KUBE_ROOT}/hack/lib/init.sh"
24+
GOROOT=$(go env GOROOT)
2425

2526
runTests() {
2627
kube::etcd::start
2728

28-
go test -race -i github.com/kubernetes-incubator/service-catalog/test/integration/... -c \
29+
if [[ -w ${GOROOT}/pkg ]]; then
30+
FLAGS="-i"
31+
elif [[ -n ${PKGDIR:-} ]]; then
32+
FLAGS="-pkgdir $PKGDIR"
33+
else
34+
FLAGS=""
35+
fi
36+
37+
go test -race $FLAGS github.com/kubernetes-incubator/service-catalog/test/integration/... -c \
2938
&& ./integration.test -test.v $@
3039
}
3140

0 commit comments

Comments
 (0)