Skip to content

Commit

Permalink
use variable to select packages to test with bazel
Browse files Browse the repository at this point in the history
During unit test development, it is very helpful being able to only test
a single package. This can be achieved by setting the variable
WHAT
Example:
  export WHAT="//pkg/virt-handler/..."
  make test

Signed-off-by: Alice Frosi <[email protected]>
  • Loading branch information
alicefr committed Apr 28, 2023
1 parent bbf4069 commit 9dea940
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bazel-push-images:
push: bazel-push-images

bazel-test:
hack/dockerized "hack/bazel-fmt.sh && CI=${CI} ARTIFACTS=${ARTIFACTS} hack/bazel-test.sh"
hack/dockerized "hack/bazel-fmt.sh && CI=${CI} ARTIFACTS=${ARTIFACTS} WHAT=${WHAT} hack/bazel-test.sh"

gen-proto:
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/gen-proto.sh"
Expand Down
4 changes: 3 additions & 1 deletion hack/bazel-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ source hack/common.sh
source hack/bootstrap.sh
source hack/config.sh

WHAT=${WHAT:=-"//staging/src/kubevirt.io/client-go/... //pkg/... //cmd/... //tests/framework/..."}

rm -rf ${ARTIFACTS}/junit ${ARTIFACTS}/testlogs

if [ "${CI}" == "true" ]; then
Expand All @@ -28,4 +30,4 @@ fi
bazel test \
--config=${ARCHITECTURE} \
--features race \
--test_output=errors -- //staging/src/kubevirt.io/client-go/... //pkg/... //cmd/... //tests/framework/...
--test_output=errors -- ${WHAT}

0 comments on commit 9dea940

Please sign in to comment.