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
Control who gets notified by GerritStatusPush #2411
Conversation
@dinatale2, thanks for your PR! By analyzing the annotation information on this pull request, we identified @tardyp, @adeason and @sa2ajj to be potential reviewers |
a702e1e
to
3f23f12
Compare
Current coverage is 86.75% (diff: 100%)@@ master #2411 diff @@
==========================================
Files 298 298
Lines 30940 30944 +4
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 26842 26846 +4
Misses 4098 4098
Partials 0 0
|
Hi we would appreciate some unit tests to test this feature, so that it does not reduce the coverage |
b021f07
to
edf3837
Compare
@@ -175,6 +176,7 @@ def reconfigService(self, server, username, reviewCB=DEFAULT_REVIEW, | |||
self.summaryCB = summaryCB | |||
self.summaryArg = summaryArg | |||
self.builders = builders | |||
self.gerrit_notify = notify |
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.
while legacy code extensively uses public members, the new code is expected to be aware whether it's a part of the class' API or not. I'd suggest to use _gerrit_notify
@@ -397,6 +399,10 @@ def sendCodeReview(self, project, revision, result): | |||
return | |||
|
|||
command = self._gerritCmd("review", "--project %s" % (project,)) | |||
|
|||
if self.gerrit_notify is not None: | |||
command.extend(["--notify %s" % str(self.gerrit_notify)]) |
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 do you use .extend
for a single item? use .append
please use '
not "
@@ -142,7 +142,8 @@ def setUp(self): | |||
def setupGerritStatusPushSimple(self, *args, **kwargs): | |||
serv = kwargs.pop("server", "serv") | |||
username = kwargs.pop("username", "user") | |||
gsp = GerritStatusPush(serv, username, *args, **kwargs) | |||
notify = kwargs.pop("notify", None) |
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.
ditto for "
|
||
# now test the notify argument | ||
gsp.gerrit_notify = 'OWNER' | ||
gsp.processVersion("2.6", lambda: None) |
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.
please make sure that all strings that do not include '
use "
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 not a python pro by any means. Do you mind clarifying when to use '
instead of "
? For one of the other comments above (in the .extend comment), you suggested I use '
instead of "
is why I ask.
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.
Well, per String Quotes in PEP-8, both "
and '
are OK, however it's good to stick to some particular way.
So far, we've been using "
for docstrings only """
and '
for all other string literals (some legacy code does not follow this, I must admit).
1d12236
to
ab229f8
Compare
|
||
# now test the notify argument, even though _gerrit_notify | ||
# is private, work around that | ||
gsp._gerrit_notify = "OWNER" |
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.
please make sure that you use single quotes everywhere (even in tests).
['ssh', 'user@serv', '-p', '29418', 'gerrit', 'review', | ||
'--project project', '--notify OWNER', "--message 'bla'", '--label Verified=1', 'revision']) | ||
|
||
# <=2.5 uses other syntax |
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.
2.5 of what?
ab229f8
to
e00dd9b
Compare
I've updated this replacing the |
looks good. There is stil a need for documentation update, and release notes |
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.
Needs doc update and relnotes update.
thanks!
e00dd9b
to
67236ac
Compare
docs and release notes have been updated. Let me know if I need to make any additional changes. |
@@ -738,6 +738,7 @@ GerritStatusPush can send a separate review for each build that completes, or a | |||
:param builders: (optional) list of builders to send results for. | |||
This method allows to filter results for a specific set of builder. | |||
By default, or if builders is None, then no filtering is performed. | |||
:param notify: (optional) control who gets notified by Gerrit once the status is posted. |
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 this would deserve to document which values are possible, probably point on the gerrit documentation, explaining that this correspond to the --notify values.
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.
Updated.
Allow the GerritStatusPush object to accept who to notify as an argument. The notify argument is a string which accepts values found in the gerrit documentation for the --notify flag. The argument is set to None by default to maintain current functionality. Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
67236ac
to
3945799
Compare
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.
LGTM
Allow the GerritStatusPush object to accept who to notify as an argument. The notify argument is a string
which accepts values found in the gerrit documentation for the
--notify
flag. The argument is set to None bydefault to maintain current functionality.
Signed-off-by: Giuseppe Di Natale dinatale2@llnl.gov