Browse Source

Merge "Ensure correct lexical sorting of node requests"

tags/3.7.0
Zuul 2 months ago
parent
commit
9f139d0481

+ 1
- 0
tests/fixtures/config/job-pause-priority/git/common-config/zuul.yaml View File

@@ -2,6 +2,7 @@
2 2
     name: check
3 3
     manager: independent
4 4
     post-review: true
5
+    precedence: high
5 6
     trigger:
6 7
       gerrit:
7 8
         - event: patchset-created

+ 2
- 2
tests/unit/test_v3.py View File

@@ -5265,7 +5265,7 @@ class TestJobPausePriority(AnsibleZuulTestCase):
5265 5265
 
5266 5266
         reqs = self.fake_nodepool.getNodeRequests()
5267 5267
         self.assertEqual(len(reqs), 1)
5268
-        self.assertEqual(reqs[0]['_oid'], '200-0000000000')
5268
+        self.assertEqual(reqs[0]['_oid'], '100-0000000000')
5269 5269
         self.assertEqual(reqs[0]['provider'], None)
5270 5270
 
5271 5271
         self.fake_nodepool.unpause()
@@ -5280,7 +5280,7 @@ class TestJobPausePriority(AnsibleZuulTestCase):
5280 5280
                 break
5281 5281
 
5282 5282
         self.assertEqual(len(reqs), 1)
5283
-        self.assertEqual(reqs[0]['_oid'], '199-0000000001')
5283
+        self.assertEqual(reqs[0]['_oid'], '099-0000000001')
5284 5284
         self.assertEqual(reqs[0]['provider'], 'test-provider')
5285 5285
 
5286 5286
         self.fake_nodepool.unpause()

+ 1
- 1
zuul/zk.py View File

@@ -166,7 +166,7 @@ class ZooKeeper(object):
166 166
         node_request.created_time = time.time()
167 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 170
         path = self.client.create(path, self._dictToStr(data),
171 171
                                   makepath=True,
172 172
                                   sequence=True, ephemeral=True)

Loading…
Cancel
Save