summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-15 05:47:33 +0000
committerGerrit Code Review <review@openstack.org>2019-03-15 05:47:33 +0000
commit9f139d04811a0d0e4acb87f38576f66bb187125b (patch)
treec9f2ac718990ca821e6e654c1143888f6bfda2c8
parent88b16685a3177eecba3eb46c880b2aabac22d23e (diff)
parente0321f0daa395508b00ede277ad0cae938e009dc (diff)
Merge "Ensure correct lexical sorting of node requests"
-rw-r--r--tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml1
-rw-r--r--tests/unit/test_v3.py4
-rw-r--r--zuul/zk.py2
3 files changed, 4 insertions, 3 deletions
diff --git a/tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml b/tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml
index a07342e..1480b90 100644
--- a/tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml
+++ b/tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml
@@ -2,6 +2,7 @@
2 name: check 2 name: check
3 manager: independent 3 manager: independent
4 post-review: true 4 post-review: true
5 precedence: high
5 trigger: 6 trigger:
6 gerrit: 7 gerrit:
7 - event: patchset-created 8 - event: patchset-created
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index c0c5d6c..075f776 100644
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -5265,7 +5265,7 @@ class TestJobPausePriority(AnsibleZuulTestCase):
5265 5265
5266 reqs = self.fake_nodepool.getNodeRequests() 5266 reqs = self.fake_nodepool.getNodeRequests()
5267 self.assertEqual(len(reqs), 1) 5267 self.assertEqual(len(reqs), 1)
5268 self.assertEqual(reqs[0]['_oid'], '200-0000000000') 5268 self.assertEqual(reqs[0]['_oid'], '100-0000000000')
5269 self.assertEqual(reqs[0]['provider'], None) 5269 self.assertEqual(reqs[0]['provider'], None)
5270 5270
5271 self.fake_nodepool.unpause() 5271 self.fake_nodepool.unpause()
@@ -5280,7 +5280,7 @@ class TestJobPausePriority(AnsibleZuulTestCase):
5280 break 5280 break
5281 5281
5282 self.assertEqual(len(reqs), 1) 5282 self.assertEqual(len(reqs), 1)
5283 self.assertEqual(reqs[0]['_oid'], '199-0000000001') 5283 self.assertEqual(reqs[0]['_oid'], '099-0000000001')
5284 self.assertEqual(reqs[0]['provider'], 'test-provider') 5284 self.assertEqual(reqs[0]['provider'], 'test-provider')
5285 5285
5286 self.fake_nodepool.unpause() 5286 self.fake_nodepool.unpause()
diff --git a/zuul/zk.py b/zuul/zk.py
index d35a5df..433fc98 100644
--- a/zuul/zk.py
+++ b/zuul/zk.py
@@ -166,7 +166,7 @@ class ZooKeeper(object):
166 node_request.created_time = time.time() 166 node_request.created_time = time.time()
167 data = node_request.toDict() 167 data = node_request.toDict()
168 168
169 path = '%s/%s-' % (self.REQUEST_ROOT, node_request.priority) 169 path = '{}/{:0>3}-'.format(self.REQUEST_ROOT, node_request.priority)
170 path = self.client.create(path, self._dictToStr(data), 170 path = self.client.create(path, self._dictToStr(data),
171 makepath=True, 171 makepath=True,
172 sequence=True, ephemeral=True) 172 sequence=True, ephemeral=True)