Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove dependency on source code in GOPATH #6

Closed
hyangah opened this issue Mar 11, 2020 · 2 comments
Closed

test: remove dependency on source code in GOPATH #6

hyangah opened this issue Mar 11, 2020 · 2 comments
Labels
chore/testing issues related to bugs in test, CI setup FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.

Comments

@hyangah
Copy link
Contributor

hyangah commented Mar 11, 2020

Current tests require GOPATH env var to be explicitly set
(

assert.ok(gopath, 'Cannot run tests if GOPATH is not set as environment variable');
)

and depend on source code preexisting under GOPATH/src.
(

// Since the Go extension takes a dependency on the godef tool at github.com/rogpeppe/godef
)

That is not ideal. Fix that.

gopherbot pushed a commit that referenced this issue Mar 17, 2020
If the env var GOPATH is not set when the test runs,
now it runs `go env GOPATH` to retrieve the default value
the underlying go commands will use. I wished I could make
this command run asynchronously, but I am not familiar with
the test framework and failed to make it working with
async functions. So, like many other file operations used in
the test setup phase, I am using execFileSync.

Update  #6

Change-Id: Id075827ab8ebd955f7a86460aaa7ea4e0e7cd183
GitHub-Last-Rev: 6222158
GitHub-Pull-Request: #8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223177
Reviewed-by: Andrew Bonventre <[email protected]>
hyangah added a commit to hyangah/vscode-go-old that referenced this issue Mar 20, 2020
If the env var GOPATH is not set when the test runs,
now it runs `go env GOPATH` to retrieve the default value
the underlying go commands will use. I wished I could make
this command run asynchronously, but I am not familiar with
the test framework and failed to make it working with
async functions. So, like many other file operations used in
the test setup phase, I am using execFileSync.

Update  golang/vscode-go#6

Change-Id: Id075827ab8ebd955f7a86460aaa7ea4e0e7cd183
GitHub-Last-Rev: 6222158
GitHub-Pull-Request: golang/vscode-go#8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223177
Reviewed-by: Andrew Bonventre <[email protected]>
hyangah added a commit to hyangah/vscode-go-old that referenced this issue Mar 28, 2020
If the env var GOPATH is not set when the test runs,
now it runs `go env GOPATH` to retrieve the default value
the underlying go commands will use. I wished I could make
this command run asynchronously, but I am not familiar with
the test framework and failed to make it working with
async functions. So, like many other file operations used in
the test setup phase, I am using execFileSync.

Update  golang/vscode-go#6

Change-Id: Id075827ab8ebd955f7a86460aaa7ea4e0e7cd183
GitHub-Last-Rev: 6222158
GitHub-Pull-Request: golang/vscode-go#8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223177
Reviewed-by: Andrew Bonventre <[email protected]>
ramya-rao-a pushed a commit to microsoft/vscode-go that referenced this issue Mar 28, 2020
* test/integration: use default GOPATH when the env var is not set

If the env var GOPATH is not set when the test runs,
now it runs `go env GOPATH` to retrieve the default value
the underlying go commands will use. I wished I could make
this command run asynchronously, but I am not familiar with
the test framework and failed to make it working with
async functions. So, like many other file operations used in
the test setup phase, I am using execFileSync.

Update  golang/vscode-go#6

Change-Id: Id075827ab8ebd955f7a86460aaa7ea4e0e7cd183
GitHub-Last-Rev: 6222158
GitHub-Pull-Request: golang/vscode-go#8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223177
Reviewed-by: Andrew Bonventre <[email protected]>

* test/integration: resolve gopath in suiteSetup hook
@stamblerre stamblerre added the chore/testing issues related to bugs in test, CI setup label May 11, 2020
@stamblerre stamblerre changed the title Tests shouldn't depend on source code in GOPATH test: remove dependency on source code in GOPATH May 11, 2020
@gopherbot gopherbot removed the chore/testing issues related to bugs in test, CI setup label May 15, 2020
@stamblerre stamblerre added NeedsFix The path to resolution is known, but the work has not been done. chore/testing issues related to bugs in test, CI setup labels Jun 3, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/244771 mentions this issue: test/integration: do not depend on real packages in testing

hyangah added a commit to hyangah/vscode-go that referenced this issue Jul 24, 2020
Tests involving vendoring assumed that the source code of
github.com/rogpeppe/godef and github.com/ramya-rao-a/go-outline
is already checked out under GOPATH or toolsGopath.
Since we install tools in modules mode, that is no longer true.

This CL removes the assumption but adds a test fixture 'vendoring'
that contains a vendor directory.

Update golang#6

Change-Id: Id0e07ee3bd6a689c73652b306e7f6b3ed705bf72
hyangah added a commit to hyangah/vscode-go that referenced this issue Jul 24, 2020
Tests do not need the source code of some tools.
Build all tools in modules mode as the extension does.

Also, remove explicit setting of GOPATH for testing.

Fixes golang#6

Change-Id: Ifff7262bd0debece5781ac73c091ba9d15acc440
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/244772 mentions this issue: build,.github/workflows: install all tools in modules mode

gopherbot pushed a commit that referenced this issue Jul 28, 2020
Tests involving vendoring assumed that the source code of
github.com/rogpeppe/godef and github.com/ramya-rao-a/go-outline
is already checked out under GOPATH or toolsGopath.
Since we install tools in modules mode, that is no longer true.

This CL removes the assumption but adds a test fixture 'vendoring'
that contains a vendor directory.

Update #6

Change-Id: Id0e07ee3bd6a689c73652b306e7f6b3ed705bf72
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/244771
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
@golang golang locked and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
chore/testing issues related to bugs in test, CI setup FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants