From 0856a4de53d77e1b90a45e950741aac1cb430ccf Mon Sep 17 00:00:00 2001 From: jingzhang36 Date: Wed, 2 Sep 2020 17:57:05 +0800 Subject: [PATCH] test(backend): use go test in backend presubmit test (#4417) * enable pagination when expanding experiment in both the home page and the archive page * Revert "enable pagination when expanding experiment in both the home page and the archive page" This reverts commit 5b672739dd88235d41b5867666db917a8eb80a10. * checkpoint * go test to replace bazel test * go command * test current directory when go test is run * remove accidentally committed file * adjust relative path according to pwd * go test seems missing dependency pkgs * need go version that supports mod * try download .tar.gz to install go version 1.13.* * adjust the path according to the extracted package * put go src and kubeflow/pipelines under the same go/src seems to give me a vendor inconsisten error. so separate them. * use non-relative path; non-verbose for wget and tar --- go.mod | 2 +- test/presubmit-backend-test.sh | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 5ce99dfe99c..2caa2a2df4a 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/peterhellberg/duration v0.0.0-20191119133758-ec6baeebcd10 github.com/pkg/errors v0.8.0 - github.com/prometheus/client_golang v0.9.2 // indirect + github.com/prometheus/client_golang v0.9.2 github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 github.com/sirupsen/logrus v1.0.6 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect diff --git a/test/presubmit-backend-test.sh b/test/presubmit-backend-test.sh index 478065f91f7..a32a45d71b7 100755 --- a/test/presubmit-backend-test.sh +++ b/test/presubmit-backend-test.sh @@ -14,14 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# usage: `./hack/run_unit_tests_backend.sh` to run backend unit tests once -# `WATCH=true ./hack/run_unit_tests_backend.sh` to watch code changes and auto rerun tests -# Note: ibazel can be downloaded from https://github.com/bazelbuild/bazel-watcher - -COMMAND="bazel" -if [ -n "$WATCH" ]; then - COMMAND="ibazel" -fi -$COMMAND --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m test \ - --noshow_progress --noshow_loading_progress --define=grpc_no_ares=true \ - --test_output=all //backend/... +# The current directory is /home/prow/go/src/github.com/kubeflow/pipelines +# 1. install go in /home/prow/go1.13.3 +cd /home/prow +mkdir go1.13.3 +cd go1.13.3 +wget --quiet https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz +tar -xf go1.13.3.linux-amd64.tar.gz +# 2. run test in project directory +cd /home/prow/go/src/github.com/kubeflow/pipelines +/home/prow/go1.13.3/go/bin/go mod vendor +/home/prow/go1.13.3/go/bin/go test -v -cover ./backend/...