-
Notifications
You must be signed in to change notification settings - Fork 152
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
Fully functioning Balrog Agent #103
Conversation
@rail - What do you think of the current state of things? I've fixed up everything you mentioned. The test coverage is pretty bad, but client.py and cmd.py are not very testable :(. |
I did things like https://github.com/escapewindow/scriptworker/blob/master/scriptworker/poll.py#L69 : If you wanted to make I also ended up mocking the heck out of everything to get 100% unittest coverage for scriptworker.worker: https://github.com/escapewindow/scriptworker/blob/master/tests/test_worker.py#L107 and I added integration tests to make sure it actually worked against taskcluster: https://github.com/escapewindow/scriptworker/blob/master/tests/test_integration.py So testing these things is doable. It takes effort. I think it's worth it in avoiding future bugs and mistakes. Also, it's easier to r- when someone submits a PR without tests if you're at 100% coverage and their patch drops it to 99%, rather than if someone submits a PR and drops your coverage from 49% to 48%, for example. |
Alright, this latest push adds tests for the vast majority of the business logic. changes.py is fully tested (minus get_telemetry_uptake, which is just a stub). run_agent is mostly tested, except for the parts that make it an infinite loop in production. |
@escapewindow or @rail - any additional thoughts on this? |
I think I'm good. Thanks for being open minded about tests! |
logging.debug("Change %s is not ready", change["sc_id"]) | ||
|
||
except: | ||
logging.error(traceback.format_exc()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have use logging.error(msg, exc_info=True)
to avoid extra imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not critical though.
OK @rail, I think this is ready for a final look now. |
🚜 it |
(I don't suggest looking at this pull request to review. This is built on top of a series of patches, so the PR includes a bunch of stuff that's not really part of the agent. I think the best view of it is https://github.com/mozbhearsum/balrog/compare/rule-changes-web...balrog-agent?expand=1.)
I've gone through a cleanup pass on this, but I think it can probably be improved more still. Here's the highlights:
@rail - I'd love to get your thoughts on this, you have pretty good asyncio/aiohttp knowledge.