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

x/tools/playground/socket: TestBuffer has bug and is and flaky #18275

Closed
bradfitz opened this issue Dec 10, 2016 · 1 comment
Closed

x/tools/playground/socket: TestBuffer has bug and is and flaky #18275

bradfitz opened this issue Dec 10, 2016 · 1 comment
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bradfitz
Copy link
Contributor

https://build.golang.org/log/d0bbf1dab2aa5580d7e5e975dc614c6bf6041593 says:

--- FAIL: TestBuffer (0.03s)
	socket_test.go:30: got 4 messages, want 2
FAIL
FAIL	golang.org/x/tools/playground/socket	0.164s

But the code:

        if len(ms) != 3 {  
                t.Fatalf("got %v messages, want 2", len(ms))  
        }  

(3 is not 2)

More generally, the test should be rewritten to not depend on time:

func TestBuffer(t *testing.T) {  
        ch := make(chan *Message)  
        go func() {  
                ch <- &Message{Kind: "err", Body: "a"}  
                ch <- &Message{Kind: "err", Body: "b"}  
                ch <- &Message{Kind: "out", Body: "1"}  
                ch <- &Message{Kind: "out", Body: "2"}  
                time.Sleep(msgDelay * 2)  
                ch <- &Message{Kind: "out", Body: "3"}  
                ch <- &Message{Kind: "out", Body: "4"}  
                close(ch)  
        }()  

Fix as part of #11811

@bradfitz bradfitz added the Testing An issue that has been verified to require only test changes, not just a test failure. label Dec 10, 2016
@bradfitz bradfitz added this to the Go1.8Maybe milestone Dec 10, 2016
@bradfitz bradfitz self-assigned this Dec 10, 2016
@gopherbot
Copy link

CL https://golang.org/cl/34277 mentions this issue.

@golang golang locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

2 participants