-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Test against a list of versions generated from docker/docker tags #2069
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
Conversation
script/versions.py
Outdated
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 you expand this out to not be on one line please? I'm not sure I've properly understood what's the intent and why you need to do this calculation. rc will already be an empty string if it didn't exist after the parse function right? Why do you want a (None, self.rc) returned. What piece of context have I missed.
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 could definitely use a docstring to explain it.
The issue is that "default ordering" for this object would put rc releases after the canonical release. This (None, self.rc) forces any release that was an rc release to come before the canonical (non-rc) release because None is sorted to the front of the sequence before any other character.
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.
Ah right, I wasn't expecting that None would get sorted in front of any characters.
A docstring would also be helpful, I would still expand it out. It's not bash, you can have more than 1 line of code 👯 I feel having an if branch would help readability here.
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.
Yeah this is a bit of a puzzle to me, especially as I don't know the operator precedence between + and if off the top of my head.
Furthermore, I'd feel better if we didn't require readers of the code to know that fact about sorting. Instead of None and '', how about 0 and 1?
if self.rc:
return (self.major, self.minor, self.patch, 0, self.rc)
else:
return (self.major, self.minor, self.patch, 1)I know it's verbose, but at least it's really clear what the return value will look like in both cases, so I don't have to construct a tuple in my head and consult the class definition when reading.
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.
Ok, I've pushed a new version of this that I think makes it a lot more readable. It removes the need to know about operator precedence and it's explicit about the parts being returned on the return line.
d410943 to
e40b8b3
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
e40b8b3 to
6edb6fa
Compare
|
Added more docstrings with example responses and reference to the github api docs |
|
LGTM |
Test against a list of versions generated from docker/docker tags
Instead of having to update the docker versions we test against, query the github api and test against the most recent releases for the last two
major.minorreleases.