From 4ed1766055813ec2bc77d82e5626c14b21749859 Mon Sep 17 00:00:00 2001 From: Robert Lin Date: Fri, 3 Jun 2022 13:52:48 -0700 Subject: [PATCH] dev/ci: remove set -x in all tests (#36577) IMO the utility of these are quite debatable, and they make CI output quite difficult to read. Things we can do instead: - Just add set -x when you're debugging something - Add better messages with echo - Move things to sg where we might be able to add a -debug mode one day --- dev/ci/go-test.sh | 1 - dev/ci/integration/backend/test.sh | 2 +- dev/ci/integration/cluster/test.sh | 4 ++-- dev/ci/integration/code-intel/test.sh | 3 +-- dev/ci/integration/e2e/test.sh | 2 +- dev/ci/integration/qa/test.sh | 3 +-- dev/ci/integration/upgrade/test.sh | 5 +---- dev/ci/reset-test-db.sh | 2 +- 8 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dev/ci/go-test.sh b/dev/ci/go-test.sh index 8239559e44c..acb8e0a660f 100755 --- a/dev/ci/go-test.sh +++ b/dev/ci/go-test.sh @@ -56,7 +56,6 @@ function go_test() { # Create annotation from test failure if [ "$test_exit_code" -ne 0 ]; then - set -x echo "~~~ Creating test failures anotation" RICHGO_CONFIG="./.richstyle.yml" cp "$REPO_ROOT/dev/ci/go-test-failures.richstyle.yml" $RICHGO_CONFIG diff --git a/dev/ci/integration/backend/test.sh b/dev/ci/integration/backend/test.sh index cd78cf48d88..66dad1fad92 100755 --- a/dev/ci/integration/backend/test.sh +++ b/dev/ci/integration/backend/test.sh @@ -3,7 +3,7 @@ # This script runs the backend integration tests against a running server. cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." -set -ex +set -e URL="${1:-"http://localhost:7080"}" diff --git a/dev/ci/integration/cluster/test.sh b/dev/ci/integration/cluster/test.sh index 1e2000d061e..c4830e1cea6 100755 --- a/dev/ci/integration/cluster/test.sh +++ b/dev/ci/integration/cluster/test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail # setup DIR for easier pathing test dir test_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"" @@ -85,7 +85,7 @@ function test_setup() { set +x +u # shellcheck disable=SC1091 source /root/.sg_envrc - set -x -u + set -u echo "--- TEST: Checking Sourcegraph instance is accessible" diff --git a/dev/ci/integration/code-intel/test.sh b/dev/ci/integration/code-intel/test.sh index c6f214ff699..a7cd09c01a7 100755 --- a/dev/ci/integration/code-intel/test.sh +++ b/dev/ci/integration/code-intel/test.sh @@ -5,7 +5,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." root_dir=$(pwd) -set -ex +set -e export SOURCEGRAPH_BASE_URL="${1:-"http://localhost:7080"}" @@ -21,7 +21,6 @@ pushd dev/ci/integration/code-intel || exit 1 set +x # shellcheck disable=SC1091 source /root/.sg_envrc -set -x "${root_dir}/init-sg" addRepos -config repos.json popd || exit 1 diff --git a/dev/ci/integration/e2e/test.sh b/dev/ci/integration/e2e/test.sh index c035a386bce..ff64e55120a 100755 --- a/dev/ci/integration/e2e/test.sh +++ b/dev/ci/integration/e2e/test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." -set -ex +set -e URL="${1:-"http://localhost:7080"}" diff --git a/dev/ci/integration/qa/test.sh b/dev/ci/integration/qa/test.sh index 4848c2c331f..f2954ef352a 100755 --- a/dev/ci/integration/qa/test.sh +++ b/dev/ci/integration/qa/test.sh @@ -6,7 +6,7 @@ export SOURCEGRAPH_BASE_URL="${1:-"http://localhost:7080"}" source /root/.profile cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." -set -ex +set -e echo "--- init sourcegraph" pushd internal/cmd/init-sg @@ -17,7 +17,6 @@ popd set +x # shellcheck disable=SC1091 source /root/.sg_envrc -set -x echo "--- TEST: Checking Sourcegraph instance is accessible" curl -f http://localhost:7080 diff --git a/dev/ci/integration/upgrade/test.sh b/dev/ci/integration/upgrade/test.sh index 71df244ba51..a26e8eb0c09 100755 --- a/dev/ci/integration/upgrade/test.sh +++ b/dev/ci/integration/upgrade/test.sh @@ -4,7 +4,7 @@ source /root/.profile cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." root_dir=$(pwd) -set -ex +set -e URL="${1:-"http://localhost:7080"}" @@ -31,11 +31,8 @@ pushd internal/cmd/init-sg go build ./init-sg initSG popd -# Load variables set up by init-server, disabling `-x` to avoid printing variables -set +x # shellcheck disable=SC1091 source /root/.sg_envrc -set -x # Stop old Sourcegraph release docker container stop "$CONTAINER" diff --git a/dev/ci/reset-test-db.sh b/dev/ci/reset-test-db.sh index 0d6cfa00ce0..e799fc319fb 100755 --- a/dev/ci/reset-test-db.sh +++ b/dev/ci/reset-test-db.sh @@ -2,6 +2,6 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/../.. -set -ex +set -e psql -d sourcegraph-test-db -c 'drop schema public cascade; create schema public;'