Skip to content

Several small test fixes#50

Merged
brian-brazil merged 1 commit into
prometheus:masterfrom
andersschuller:test-fixes
Oct 2, 2015
Merged

Several small test fixes#50
brian-brazil merged 1 commit into
prometheus:masterfrom
andersschuller:test-fixes

Conversation

@andersschuller

Copy link
Copy Markdown
Contributor

@brian-brazil: This bundles together a few small fixes for the tests. Please let me know if you would prefer them as separate pull requests.

  • First of all, test_client.py contained two tests with the same name (test_pushadd_with_groupingkey), so I renamed the second one to the more appropriate test_delete_with_groupingkey.
  • I also noticed a race condition in the tests, where the assertions that check the received request could be run just before the requests are stored. I fixed this by calling send_response after the request is stored, instead of before.
  • I then looked at issue tests fail for Python 3.4 on Debian 8 #46. It seems there are some small differences in either the HTTP server or client between Python 2.7 and 3.4, which means a call to end_headers is required in the HTTP handler for Python 3.4.
  • Finally, I ran into some issues running the tests on my Windows machine. It turns out that socket.connect throws an error on Windows when using '0.0.0.0' or the empty string as the target host (although either seems to work fine on Linux). I therefore changed the tests to use 'localhost' as the target host instead. This does also affect the instance_ip_grouping_key function exposed in the client module, but from some quick testing on my Linux machine there seems to be no difference between the old and new way.

Let me know if you have any questions or comments.

Comment thread tests/graphite_bridge.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here so a future Unix-user doesn't undo this?

@brian-brazil

Copy link
Copy Markdown
Contributor

Thanks for all the fixes, can you squash the commits please?

- Rename test with duplicate name
- Fix race condition in test HTTP handler
- Add call to end_headers in test HTTP handler
- Use localhost when connecting to a local socket, not 0.0.0.0
@andersschuller

Copy link
Copy Markdown
Contributor Author

All right, commits squashed.

brian-brazil added a commit that referenced this pull request Oct 2, 2015
@brian-brazil brian-brazil merged commit 91a928b into prometheus:master Oct 2, 2015
@brian-brazil

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants