Skip to content

Commit

Permalink
cmd/govim: put install scripts tests behind env var (govim#632)
Browse files Browse the repository at this point in the history
Currently we skip long-running tests when running go test with -short.
This is standard practice. But as part of efforts to add the govim test
suite to the gopls integration tests:

https://go-review.googlesource.com/c/tools/+/212018

we now need to distinguish between all long running tests and those long
running tests that are install/network related.

Hence we now only run install script tests when
GOVIM_RUN_INSTALL_TESTSCRIPTS=true.

Fixes govim#631
  • Loading branch information
myitcv committed Dec 20, 2019
1 parent 29ba8dc commit 63ce556
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions _scripts/dockerRun.sh
Expand Up @@ -36,6 +36,9 @@ go install golang.org/x/tools/gopls
# remove all generated files to ensure we are never stale
rm -f $(git ls-files -- ':!:cmd/govim/internal/golang_org_x_tools' '**/gen_*.*' 'gen_*.*') .travis.yml

# run the install scripts
export GOVIM_RUN_INSTALL_TESTSCRIPTS=true

go generate $(go list ./... | grep -v 'govim/internal/golang_org_x_tools')
go test $(go list ./... | grep -v 'govim/internal/golang_org_x_tools')

Expand Down
8 changes: 6 additions & 2 deletions cmd/govim/main_test.go
Expand Up @@ -26,6 +26,10 @@ import (
"github.com/rogpeppe/go-internal/testscript"
)

const (
EnvInstallScripts = "GOVIM_RUN_INSTALL_TESTSCRIPTS"
)

var (
fDebugLog = flag.Bool("debugLog", false, "Whether to log debugging info from vim, govim and the test shim")
fGoplsPath = flag.String("gopls", "", "Path to the gopls binary for use in scenario tests. If unset, gopls is built from a tagged version.")
Expand Down Expand Up @@ -199,8 +203,8 @@ func TestScripts(t *testing.T) {
}

func TestInstallScripts(t *testing.T) {
if testing.Short() {
t.Skip("Install scripts are long-running")
if os.Getenv(EnvInstallScripts) != "true" {
t.Skipf("Skipping install scripts; %v != true", EnvInstallScripts)
}

govimPath := strings.TrimSpace(runCmd(t, "go", "list", "-m", "-f={{.Dir}}"))
Expand Down

0 comments on commit 63ce556

Please sign in to comment.