-
Notifications
You must be signed in to change notification settings - Fork 106
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
WIP: Initial message schema for Anitya #570
Conversation
df9292c
to
832e387
Compare
As Fedora-messaging is released with version 1.0.0, this could be a good addition to the project. @jeremycline |
I'm going to take a bit of time today or tomorrow to clean it up, it'll be a good first app to move over |
b0f4677
to
d913085
Compare
Codecov Report
@@ Coverage Diff @@
## master #570 +/- ##
==========================================
- Coverage 96.49% 90.14% -6.35%
==========================================
Files 56 56
Lines 2909 2690 -219
Branches 392 352 -40
==========================================
- Hits 2807 2425 -382
- Misses 64 201 +137
- Partials 38 64 +26
Continue to review full report at Codecov.
|
d913085
to
9722666
Compare
I looked at the failing Travis job and it failed, because it took to long. The last test suite running was The
|
Yup, I'm not done with this yet, sorry for the noise |
9722666
to
147f9d7
Compare
This defines message schema using json-schema for the messages Anitya sends. It does not, however, implement any Python API work with these messages. Signed-off-by: Jeremy Cline <[email protected]>
This is the bare minimum to publish messages using fedora_messaging. It includes support to use the fedmsg publisher as a config option in case things go wrong during deployment. This can be removed later. Signed-off-by: Jeremy Cline <[email protected]>
147f9d7
to
a893d6e
Compare
Ok, I will than fix #635 first than. |
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.
It looks good I just have a few comments
@@ -38,19 +40,29 @@ | |||
|
|||
def fedmsg_publish(*args, **kwargs): # pragma: no cover |
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.
I think it will be good to rename this function to publish
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.
This is a interim solution. The most reasonable refactor is likely to get rid of this function entirely. The reason is that different messages almost certainly have different failure scenarios and once you get rid of the fedmsg portion of this function, all it's doing is squashing exceptions.
@@ -177,68 +180,66 @@ def create_distro(session): | |||
|
|||
def create_project(session): | |||
""" Create some basic projects to work with. """ | |||
utilities.create_project( |
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.
I'm glad to see you are getting rid of the utilities functions. I want to remove most of them in the future.
"type": "object", | ||
"required": ["project", "message", "distro"], | ||
"properties": { | ||
"distro": {"type": "null"}, |
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.
Why are we sending this in project related messages?
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.
So these schema aren't what we should be sending, it's just what the current messages look like. Most of the message schema are crazy and make no sense. This is more about documenting the madness so we can fix it than it is about laying out a reasonable set of messages. Once we've done that you can come up with reasonable messages and a migration plan for consumers.
"type": "object", | ||
"properties": { | ||
"agent": {"type": "string"}, | ||
"odd_change": {"type": "boolean"}, |
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.
This is no longer happening. I removed this error when I introduced check for multiple versions.
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.
That's not good :(
The message schema changed and it's possible consumers were relying on that field. If, for example, the-new-hotness expects this key to be present it will crash. The best path forward is likely to make sure that key remains the message getting sent out and is always false or something.
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.
Oh, I didn't knew this could have impact like this. The change is only on master right now. It wasn't released yet, so I can add the field back.
It's hard to know what is required.
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.
The odd_change is now always false.
@@ -0,0 +1,20 @@ | |||
# Copyright (C) 2018 Red Hat, Inc. |
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.
Fixtures are really nice solution for testing.
The fixtures are generated by downloading messages from datagrepper. | ||
""" | ||
|
||
def test_valid(self): |
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.
I don't see any assert in this method.
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.
Yep, that's expected, although I should probably add a comment to that effect. validate()
raises an exception if the message is invalid which would cause the test to fail. The assertion is a basically there there isn't an exception.
|
||
|
||
setup( | ||
name="anitya_schema", |
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.
I expect that this should be the package I have to import in the-new-hotness.
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.
Correct, it'll be published to PyPI/packaged separately from anitya so consumers can just pull in the schema
@jeremycline All the blocking PRs should be merged now, so you can continue on this PR when you have time. |
I'm merging this and continue working where @jeremycline ended. |
This defines message schema using json-schema for a subset of messages
sent by Anitya.
Signed-off-by: Jeremy Cline [email protected]