Skip to content

Commit

Permalink
Merge pull request #491 from Okabe-Rintarou-0/feat/ut
Browse files Browse the repository at this point in the history
support run specified unit test (#488)
  • Loading branch information
kmesh-bot authored Jul 5, 2024
2 parents c78488f + c5ab11b commit 33e97a1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions hack/run-ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ ROOT_DIR=$(git rev-parse --show-toplevel)

. $ROOT_DIR/hack/utils.sh

function get_go_test_command() {
if [ -z "$TEST_TARGET" ]; then
echo "go test -v -race -vet=off ./pkg/..."
else
echo "go test -v -race -vet=off -run $TEST_TARGET ./pkg/..."
fi
}

go_test_command=$(get_go_test_command)

function docker_run_go_ut() {
local container_id=$1
docker exec $container_id go test -v -race -vet=off ./pkg/...
docker exec $container_id $go_test_command
}

function run_go_ut_local() {
bash $ROOT_DIR/build.sh
export PKG_CONFIG_PATH=$ROOT_DIR/mk
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOT_DIR/api/v2-c:$ROOT_DIR/bpf/deserialization_to_bpf_map
go test -v -race -vet=off ./pkg/...
eval "$go_test_command"
}

function run_go_ut_in_docker() {
Expand Down

0 comments on commit 33e97a1

Please sign in to comment.