mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1111980 - Part 6 Add slugjar to back the as_slugid functionality needed for decision tasks. r=garndt
This commit is contained in:
parent
eaba4f63d3
commit
b2868b9893
20
testing/taskcluster/taskcluster_graph/slugidjar.py
Normal file
20
testing/taskcluster/taskcluster_graph/slugidjar.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from taskcluster_graph.slugid import slugid
|
||||||
|
|
||||||
|
class SlugidJar():
|
||||||
|
'''
|
||||||
|
Container of seen slugid's used to implement the as_slugid functionality
|
||||||
|
used in the task graph templates.
|
||||||
|
'''
|
||||||
|
def __init__(self):
|
||||||
|
self._names = {}
|
||||||
|
|
||||||
|
def __call__(self, name):
|
||||||
|
'''
|
||||||
|
So this object can easily be passed to mustache we allow it to be called
|
||||||
|
directly...
|
||||||
|
'''
|
||||||
|
if name in self._names:
|
||||||
|
return self._names[name];
|
||||||
|
|
||||||
|
self._names[name] = slugid()
|
||||||
|
return self._names[name]
|
@ -26,10 +26,10 @@ scopes:
|
|||||||
- "docker-worker:cache:sources-gaia"
|
- "docker-worker:cache:sources-gaia"
|
||||||
- "docker-worker:cache:build-emulator-ics-debug"
|
- "docker-worker:cache:build-emulator-ics-debug"
|
||||||
tasks:
|
tasks:
|
||||||
- taskId: '{{ "decision task" | as-slugid }}'
|
- taskId: '{{#as_slugid }}decision task{{/as_slugid}}'
|
||||||
task:
|
task:
|
||||||
created: '{{now}}'
|
created: '{{now}}'
|
||||||
deadline: '{{ "1 day" | from-now }}'
|
deadline: '{{#from_now }}1 day{{#/from_now}}'
|
||||||
metadata:
|
metadata:
|
||||||
source: '{{source}}'
|
source: '{{source}}'
|
||||||
owner: '{{owner}}'
|
owner: '{{owner}}'
|
||||||
|
19
testing/taskcluster/tests/test_slugidjar.py
Executable file
19
testing/taskcluster/tests/test_slugidjar.py
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
import unittest
|
||||||
|
import mozunit
|
||||||
|
from datetime import datetime
|
||||||
|
from taskcluster_graph.slugidjar import SlugidJar
|
||||||
|
|
||||||
|
class SlugidJarTest(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_slugidjar(self):
|
||||||
|
subject = Jar()
|
||||||
|
self.assertEqual(subject('woot'), subject('woot'))
|
||||||
|
self.assertTrue(type(subject('woot')) is str)
|
||||||
|
|
||||||
|
other_jar = Jar()
|
||||||
|
self.assertNotEqual(subject('woot'), other_jar('woot'))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
mozunit.main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user