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

plugin: unclear how to reference a package under test from a plugin #37618

Open
gonzojive opened this issue Mar 3, 2020 · 1 comment
Open

plugin: unclear how to reference a package under test from a plugin #37618

gonzojive opened this issue Mar 3, 2020 · 1 comment
Milestone

Comments

@gonzojive
Copy link

@gonzojive gonzojive commented Mar 3, 2020

Testing interactions between a plugin and a package under test is complicated.

What version of Go are you using (go version)?

$ go version
go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/red/.cache/go-build"
GOENV="/home/red/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/red/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/red/git/go_example_failed_plugin_test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build817699318=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tried to reference the package being tested by go test from a plugin. It's unclear how to do this, and thus how to test interactions between plugins and packages being tested.

Reproduction is here:
https://github.com/gonzojive/go_example_failed_plugin_test

git clone https://github.com/gonzojive/go_example_failed_plugin_test
cd go_example_failed_plugin_test
go test codeloader/*.go

What did you expect to see?

All tests should pass

What did you see instead?

$  go test codeloader/*.go
will reference project root "/home/red/git/go_example_failed_plugin_test" when compiling pluginsThe code was loaded!--- FAIL: TestConfig_CompileAndLoadCompileTimeCode (1.21s)
    --- FAIL: TestConfig_CompileAndLoadCompileTimeCode/show_example_of_interaction_of_a_plugin_with_a_non-test_package#01 (0.59s)
        codeloader_test.go:144: manipulates RegisteredPlugins: got [], want ["interaction confirmed"]
FAIL
FAIL    command-line-arguments  1.223s
FAIL
@dmitshur dmitshur changed the title Unclear how to reference a package under test from a plugin plugin: unclear how to reference a package under test from a plugin Mar 3, 2020
@dmitshur dmitshur added this to the Backlog milestone Mar 3, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Mar 3, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.