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

After go upgrade to 1.15, the test code that can pass 1.13 cannot pass #42390

Closed
yangyiwei1143323451 opened this issue Nov 5, 2020 · 2 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@yangyiwei1143323451
Copy link

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

$ go version
go 1.15

Does this issue reproduce with the latest release?

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

go env Output
$ go env
ubuntu 18.04
Linux mi 5.4.0-48-generic #52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

What did you do?

I have a http server code and a test code for it. I can pass the test normally using go test -coverprofile=coverage.out -v in go1.13, but use go test -coverprofile=coverage.out in go1.15 -v will display could not shutdown the server: context canceled. There is no problem when using go test -v -cover, that is, only using go test -coverprofile=coverage.out -v in go1.15 will cause an error and fail the test
this is my server_test.go

	var wg sync.WaitGroup
	wg.Add(1)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	go func() {
		Serv(ctx)
		defer wg.Done()
	}()

What did you expect to see?

=== RUN   TestServ
--- PASS: TestServ (2.79s)
PASS
INFO[0031] server is shutting down                       
INFO[0031] http server exited                            
coverage: xx of statements
ok  	xxxx/xxxx/xxxx/http	31.989s

What did you see instead?

=== RUN   TestServ
--- PASS: TestServ (2.79s)
PASS
INFO[0030] server is shutting down                       
INFO[0030] could not shutdown the server: context canceled
exit status 1
FAIL		xxxx/xxxx/xxxx/http	30.117s
@ianlancetaylor
Copy link
Contributor

Can you show us a complete, standalone example that demonstrates the problem? Not a code fragment, but a complete program that we can run. Thanks.

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 5, 2020
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Dec 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants