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

Heartbeat possible flaky test on monitors/active/http #10722

Closed
sayden opened this issue Feb 13, 2019 · 3 comments
Closed

Heartbeat possible flaky test on monitors/active/http #10722

sayden opened this issue Feb 13, 2019 · 3 comments
Assignees
Labels
flaky-test Unstable or unreliable test cases. Heartbeat

Comments

@sayden
Copy link
Contributor

sayden commented Feb 13, 2019

@andrewvc I was just having issues with this. Forgive me if this is fixed already but I prefer to report and be wrong than to be right and do not report 😉

Flaky Test

Stack Trace

12:25:01 command [go test -race -tags integration -cover -coverprofile /tmp/gotestcover-146585084 github.com/elastic/beats/heartbeat/monitors/active/http]: exit status 1
12:25:01 --- FAIL: TestHTTPSx509Auth (1.42s)
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:40
12:25:01 			Error:      	mapval could not validate map
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 			Messages:   	13 errors validating source: 
12:25:01 			            	(common.MapStr) (len=4) {"error":{"message":"Get https://127.0.0.1:38334: read tcp 127.0.0.1:59732-\u003e127.0.0.1:38334: i/o timeout","type":"io"},"http":{"url":"https://127.0.0.1:38334"},"monitor":{"duration":{"us":1015296},"id":"http@https://127.0.0.1:38334","ip":"127.0.0.1","scheme":"https","status":"down"},"tcp":{"port":38334,"rtt":{"connect":{"us":610}}}}
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'tls.rtt.handshake.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.rtt.content.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'error.type': unexpected field encountered during strict validation
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'error.message': unexpected field encountered during strict validation
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'monitor.status': objects not equal: actual(down) != expected(up)
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.rtt.write_request.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'tls.certificate_not_valid_after': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'error': unexpected field encountered during strict validation
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'tls.certificate_not_valid_before': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.rtt.validate.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.response.status_code': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.rtt.response_header.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 	assertions.go:256: 
12:25:01 			Error Trace:	mapvaltest.go:48
12:25:01 			Error:      	Received unexpected error:
12:25:01 			            	@path 'http.rtt.total.us': expected this key to be present
12:25:01 			Test:       	TestHTTPSx509Auth
12:25:01 FAIL
12:25:01 coverage: 62.4% of statements
12:25:01 FAIL	github.com/elastic/beats/heartbeat/monitors/active/http	4.878s
@andrewvc
Copy link
Contributor

@sayden thanks for the ping!

I think it is indeed flakey (though very rare).

It's a tough one, because it definitely should work, and I can't repro it. I think the solution here is to have the test code wait 5 seconds or so for the HTTP endpoint to come up before running the proper test.

andrewvc added a commit to andrewvc/beats that referenced this issue Feb 16, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes elastic#10722
@andrewvc
Copy link
Contributor

Fixed here: #10789 (I hope)

Thanks for writing this excellent report.

@sayden
Copy link
Contributor Author

sayden commented Feb 18, 2019

Feel free to close the issue when you think it's done

andrewvc added a commit that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes #10722
andrewvc added a commit to andrewvc/beats that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes elastic#10722

(cherry picked from commit eaf0889)
andrewvc added a commit to andrewvc/beats that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes elastic#10722

(cherry picked from commit eaf0889)
andrewvc added a commit that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes #10722

(cherry picked from commit eaf0889)
andrewvc added a commit that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes #10722

(cherry picked from commit eaf0889)
andrewvc added a commit to andrewvc/beats that referenced this issue Feb 28, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes elastic#10722

(cherry picked from commit eaf0889)
andrewvc added a commit that referenced this issue Mar 1, 2019
Sometimes the httptest package when using fancy TLS options doesn't put the server up as fast as it should (at least that's the theory), and we hit before it's ready, causing a false test failure. This patch makes those tests more resilient.

It's possible there's something else at work here, but this bug is only seen on CI, and impossible to repro on my laptop.

Fixes #10722

(cherry picked from commit eaf0889)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Unstable or unreliable test cases. Heartbeat
Projects
None yet
Development

No branches or pull requests

2 participants