m-lab / alertmanager-github-receiver

Prometheus Alertmanager webhook receiver that creates GitHub issues from alerts
Apache License 2.0
48 stars 23 forks source link

Improve test coverage and add standard flag support #27

Closed stephen-soltesz closed 5 years ago

stephen-soltesz commented 5 years ago

This change is Reviewable

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 96


Totals Coverage Status
Change from base Build 85: 26.4%
Covered Lines: 262
Relevant Lines: 289

💛 - Coveralls
stephen-soltesz commented 5 years ago

Note: I've seen the error for both :9990 and :9393 (either server socket may fail to be available soon enough).

pboothe commented 5 years ago

cmd/github_receiver/main_test.go, line 59 at r2 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
O_o -- so, I'm a bit baffled here. I was deceived by my workstation - there is a race. But, I don't see where it's coming from. The error reported: `Could not start metric server(error: listen tcp :9990: bind: address already in use)`. This implies to me that the process has not called or completed the underlying socket close. But, I'm calling http `Server.Close` which closes all listeners, which should release the socket before returning from the `defer` statements that call `Server.Close`. But, by observation, it takes some additional time after. The delay works around that, but why isn't the shutdown / close complete after returning from `Server.Close`?

Use ":0" for your listen addresses.