8000 Several small test fixes by andersschuller · Pull Request #50 · prometheus/client_python · GitHub
[go: up one dir, main page]

Skip to content

Several small test fixes #50

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

Merged
merged 1 commit into from
Oct 2, 2015

Conversation

andersschuller
Copy link
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.

@@ -28,7 +28,8 @@ def run(self):
self.t = ServingThread()
self.t.start()

self.gb = GraphiteBridge(server.server_address, self.registry, _time=FakeTime())
address = ('localhost', server.server_address[1])
Copy link
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
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
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
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
0