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

Fix unreliable test #119

Closed
ncw opened this issue Oct 11, 2018 · 5 comments
Closed

Fix unreliable test #119

ncw opened this issue Oct 11, 2018 · 5 comments
Labels

Comments

@ncw
Copy link
Owner

ncw commented Oct 11, 2018

This keeps failing :-(

$ go test
Waiting for server to start .. Started
--- FAIL: TestWatchdogReaderOnSlowNetwork (1.23s)
	watchdog_reader_test.go:53: Timer should not have fired
FAIL
exit status 1
@ncw ncw added the bug label Oct 11, 2018
@zhsj
Copy link

zhsj commented Mar 13, 2019

Hi,

It's also reported at https://bugs.debian.org/923804, and

failure rate is so high (40%)

Could you help looking at this issue recently? It's a blocking issue in Debian to keep this library and many reverse dependencies :(

I tried reading the code, but I'm lost with the different time durations in this test.

Thanks

@ncw
Copy link
Owner Author

ncw commented Mar 15, 2019

I can't make this happen locally and it hasn't happened in the travis builds for ages :-(

Can you see if this fixes it?

diff --git a/watchdog_reader_test.go b/watchdog_reader_test.go
index 8e8f013..08dabff 100644
--- a/watchdog_reader_test.go
+++ b/watchdog_reader_test.go
@@ -98,7 +98,7 @@ func TestWatchdogReaderOnSlowNetwork(t *testing.T) {
 		delayPerByte: 200 * time.Millisecond / time.Duration(len(byteString)),
 	}
 
-	timer, firedChan := setupTimer(10 * time.Millisecond)
+	timer, firedChan := setupTimer(100 * time.Millisecond)
 	wr := newWatchdogReader(reader, 190*time.Millisecond, timer)
 
 	//use io.ReadFull instead of ioutil.ReadAll here because ReadAll already does

@zhsj
Copy link

zhsj commented Mar 16, 2019

@ncw thanks for the patched. I've built 100 times, and 0 failure with this patch, compared to 42/100 failures for the origin one.

@ncw
Copy link
Owner Author

ncw commented Mar 16, 2019

I've committed that patch and tagged a release with it in v1.0.45

Thank you for testing :-)

@ncw
Copy link
Owner Author

ncw commented Mar 16, 2019

The commit is 3623852 - this didn't get autolinked for some reason...

@ncw ncw closed this as completed Mar 16, 2019
ncw added a commit that referenced this issue Mar 17, 2019
ncw added a commit that referenced this issue Mar 19, 2019
nono pushed a commit to cozy/swift that referenced this issue Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants