1
0
mirror of https://github.com/golang/go synced 2024-11-06 10:36:13 -07:00
go/gopls/integration/govim/run_tests_for_cloudbuild.sh
Rob Findley 17a19b5fe7 internal/lsp/cmd: add a flag to disable telemetry
govim integration tests (and probably some real user sessions) are
broken because telemetry metrics are not threadsafe, resulting in an
index out of range panic.

Fix this by adding a flag (labeled temporary) to disable telemetry
export.

Also temporarily update govim to master to pick up some fixes, and run
only the -short tests to avoid timeouts.

Updates golang/go#38042

Change-Id: I584e5d200c2f732bd4024002ee6253d09623b29f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226057
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2020-03-27 18:51:17 +00:00

33 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Copyright 2020 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# This script runs govim integration tests but always succeeds, instead writing
# their result to a file so that any test failure can be deferred to a later
# build step. We do this so that we can capture govim test artifacts regardless
# of the test results.
# See golang.org/issues/38042. Temporarily disable telemetry until event
# exporters are threadsafe.
export GOVIM_GOPLS_FLAGS="-telemetry.disable"
# Substitute the locally built gopls binary for use in govim integration tests.
go test -short ./cmd/govim -gopls /workspace/gopls/gopls
# Stash the error, for use in a later build step.
echo "exit $?" > /workspace/govim_test_result.sh
# Clean up unnecessary artifacts. This is based on govim/_scripts/tidyUp.bash.
# Since we're fetching govim using the go command, we won't have this non-go
# source directory available to us.
if [[ -n "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" ]]; then
echo "Cleaning up build artifacts..."
# Make artifacts writable so that rm -rf doesn't complain.
chmod -R u+w "$GOVIM_TESTSCRIPT_WORKDIR_ROOT"
# Remove directories we don't care about.
find "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" -type d \( -name .vim -o -name gopath \) -prune -exec rm -rf '{}' \;
fi