autoland: standardise current rev determination in tests (
bug 1368516) r?smacleod
Some tests were using $REV, others had it inline.
MozReview-Commit-ID: 17d99eT4zTm
--- a/autoland/tests/test-autoland-closed-tree.t
+++ b/autoland/tests/test-autoland-closed-tree.t
@@ -36,24 +36,25 @@ Create a commit to test on Try
summary: Bug 1 - some stuff
review: http://$DOCKER_HOSTNAME:$HGPORT1/r/2 (draft)
review id: bz://1/mynick
review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
(review requests lack reviewers; visit review url to assign reviewers)
(visit review url to publish these review requests so others can see them)
+ $ REV=`hg log -r . --template "{node|short}"`
Close the tree
$ treestatus set-status $TREESTATUS_URL try closed
Post a job
- $ ottoland post-autoland-job $AUTOLAND_URL test-repo `hg log -r . --template "{node|short}"` try http://localhost:9898 --trysyntax "stuff"
+ $ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV try http://localhost:9898 --trysyntax "stuff"
(200, u'{\n "request_id": 1\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 1 --poll
timed out
Open the tree
$ treestatus set-status $TREESTATUS_URL try open
$ ottoland autoland-job-status $AUTOLAND_URL 1 --poll
--- a/autoland/tests/test-autoland-merge.t
+++ b/autoland/tests/test-autoland-merge.t
@@ -32,20 +32,20 @@ Create a commit to test on Try
changeset: 1:e2507be7827c
summary: Bug 1 - some stuff; r?cthulhu
review: http://$DOCKER_HOSTNAME:$HGPORT1/r/2 (draft)
review id: bz://1/mynick
review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
(visit review url to publish these review requests so others can see them)
+ $ REV=`hg log -r . --template "{node|short}"`
Post a job
- $ REV=`hg log -r . --template "{node|short}"`
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound http://localhost:9898 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 1\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 1 --poll
(200, u'{\n "commit_descriptions": {\n "e2507be7827c": "Bug 1 - some stuff; r=cthulhu"\n }, \n "destination": "inbound", \n "error_msg": "", \n "landed": true, \n "ldap_username": "autolanduser@example.com", \n "result": "3bce87fd55d0", \n "rev": "e2507be7827c", \n "tree": "test-repo"\n}')
$ mozreview exec autoland hg log /repos/inbound-test-repo/ --template '{rev}:{desc\|firstline}:{phase}\\n'
0:Bug 1 - some stuff; r=cthulhu:public
Post a job with a bad merge
--- a/autoland/tests/test-post-autoland-job-from-repo.t
+++ b/autoland/tests/test-post-autoland-job-from-repo.t
@@ -32,26 +32,27 @@ Create a commit to test on Try
changeset: 1:e2507be7827c
summary: Bug 1 - some stuff; r?cthulhu
review: http://$DOCKER_HOSTNAME:$HGPORT1/r/2 (draft)
review id: bz://1/mynick
review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
(visit review url to publish these review requests so others can see them)
+ $ REV=`hg log -r . --template "{node|short}"`
Ensure Autoland started without errors
$ mozreview exec autoland tail -n 20 /home/autoland/autoland.log
starting autoland
* autoland INFO starting autoland (glob)
Posting a job with bad credentials should fail
- $ ottoland post-autoland-job $AUTOLAND_URL test-repo `hg log -r . --template "{node|short}"` try http://localhost:9898 --user blah --password blah
+ $ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV try http://localhost:9898 --user blah --password blah
(401, u'Login required')
$ mozreview exec autoland tail -n1 /var/log/apache2/error.log
* WARNING:root:Failed authentication for "blah" from * (glob)
Posting a job with without both trysyntax and commit_descriptions should fail
$ ottoland post-autoland-job $AUTOLAND_URL test-repo 42 try http://localhost:9898
(400, u'{\n "error": "Bad request: one of trysyntax or commit_descriptions must be specified"\n}')
@@ -60,17 +61,16 @@ Posting a job with an unknown revision s
$ ottoland post-autoland-job $AUTOLAND_URL test-repo 42 try http://localhost:9898 --commit-descriptions "{\"42\": \"bad revision\"}"
(200, u'{\n "request_id": 1\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 1 --poll
(200, u'{\n "commit_descriptions": {\n "42": "bad revision"\n }, \n "destination": "try", \n "error_msg": "hg error in cmd: hg pull test-repo -r 42: pulling from http://hgrb/test-repo\\nabort: unknown revision \'42\'!\\n", \n "landed": false, \n "ldap_username": "autolanduser@example.com", \n "result": "", \n "rev": "42", \n "tree": "test-repo"\n}')
Post a job
- $ REV=`hg log -r . --template "{node|short}"`
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound http://localhost:9898 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 2\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 2 --poll
(200, u'{\n "commit_descriptions": {\n "e2507be7827c": "Bug 1 - some stuff; r=cthulhu"\n }, \n "destination": "inbound", \n "error_msg": "", \n "landed": true, \n "ldap_username": "autolanduser@example.com", \n "result": "3bce87fd55d0", \n "rev": "e2507be7827c", \n "tree": "test-repo"\n}')
$ mozreview exec autoland hg log /repos/inbound-test-repo/ --template '{rev}:{desc\|firstline}:{phase}\\n'
0:Bug 1 - some stuff; r=cthulhu:public
Post a job with try syntax
@@ -104,18 +104,18 @@ Post a job using a bookmark
changeset: 2:373b6ff60965
summary: Bug 1 - more goodness; r?cthulhu
review: http://$DOCKER_HOSTNAME:$HGPORT1/r/3 (draft)
review id: bz://1/mynick
review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
(visit review url to publish these review requests so others can see them)
+ $ REV=`hg log -r . --template "{node|short}"`
- $ REV=`hg log -r . --template "{node|short}"`
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound http://localhost:9898 --push-bookmark "bookmark" --commit-descriptions "{\"$REV\": \"Bug 1 - more goodness; r=cthulhu\"}"
(200, u'{\n "request_id": 4\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 4 --poll
(200, u'{\n "commit_descriptions": {\n "373b6ff60965": "Bug 1 - more goodness; r=cthulhu"\n }, \n "destination": "inbound", \n "error_msg": "", \n "landed": true, \n "ldap_username": "autolanduser@example.com", \n "push_bookmark": "bookmark", \n "result": "aba7cf08f2e4", \n "rev": "373b6ff60965", \n "tree": "test-repo"\n}')
$ mozreview exec autoland hg log /repos/inbound-test-repo/ --template '{rev}:{desc\|firstline}:{phase}\\n'
1:Bug 1 - more goodness; r=cthulhu:public
0:Bug 1 - some stuff; r=cthulhu:public
@@ -144,16 +144,17 @@ Post a job with unicode commit descripti
changeset: 3:e7f4a0f07be3
summary: Bug 1 - ?????; r?cthulhu
review: http://$DOCKER_HOSTNAME:$HGPORT1/r/4 (draft)
review id: bz://1/mynick
review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
(visit review url to publish these review requests so others can see them)
$ REV=`hg log -r . --template "{node|short}"`
+
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound http://localhost:9898 --commit-descriptions "{\"$REV\": \"Bug 1 - \\u3053\\u3093\\u306b\\u3061\\u306f; r=cthulhu\"}"
(200, u'{\n "request_id": 5\n}')
$ ottoland autoland-job-status $AUTOLAND_URL 5 --poll
(200, u'{\n "commit_descriptions": {\n "e7f4a0f07be3": "Bug 1 - \\u3053\\u3093\\u306b\\u3061\\u306f; r=cthulhu"\n }, \n "destination": "inbound", \n "error_msg": "", \n "landed": true, \n "ldap_username": "autolanduser@example.com", \n "result": "8ec6d9d32147", \n "rev": "e7f4a0f07be3", \n "tree": "test-repo"\n}')
$ mozreview exec autoland hg log --encoding=utf-8 /repos/inbound-test-repo/ --template '{rev}:{desc\|firstline}:{phase}\\n'
2:Bug 1 - \xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf; r=cthulhu:public (esc)
1:Bug 1 - more goodness; r=cthulhu:public
@@ -178,17 +179,16 @@ Getting status for an unknown job should
$ mozreview exec autoland hg log --encoding=utf-8 /repos/inbound-test-repo/ --template '{rev}:{desc\|firstline}:{phase}\\n'
2:Bug 1 - \xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf; r=cthulhu:public (esc)
1:Bug 1 - more goodness; r=cthulhu:public
0:Bug 1 - some stuff; r=cthulhu:public
Test pingback url whitelist. localhost, private IPs, and example.com are in
the whitelist. example.org is not.
- $ REV=`hg log -r . --template "{node|short}"`
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound1 http://example.com:9898 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 6\n}')
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound2 http://localhost --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 7\n}')
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound3 http://127.0.0.1 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 8\n}')
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound4 http://192.168.0.1 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(200, u'{\n "request_id": 9\n}')
@@ -201,16 +201,15 @@ the whitelist. example.org is not.
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV inbound8 http://example.org:9898 --commit-descriptions "{\"$REV\": \"Bug 1 - some stuff; r=cthulhu\"}"
(400, u'{\n "error": "Bad request: bad pingback_url"\n}')
Post the same job twice. Start with stopping the autoland service to
guarentee the first request is still in the queue when the second is submitted.
$ PID=`mozreview exec autoland ps x | grep autoland.py | grep -v grep | awk '{ print $1 }'`
$ mozreview exec autoland kill $PID
- $ REV=`hg log -r . --template "{node|short}"`
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV try http://localhost:9898 --trysyntax "stuff"
(200, u'{\n "request_id": 12\n}')
$ ottoland post-autoland-job $AUTOLAND_URL test-repo $REV try http://localhost:9898 --trysyntax "stuff"
(400, u'{\n "error": "Bad Request: a request to land revision e7f4a0f07be3 to try is already in progress"\n}')
$ mozreview stop
stopped 9 containers