mirrored from https://chromium.googlesource.com/infra/luci/recipes-py
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrealms.py
40 lines (32 loc) · 1.12 KB
/
realms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine.post_process import DropExpectation
DEPS = [
'assertions',
'buildbucket',
'context',
'step',
'swarming',
]
def RunSteps(api):
def basic_request():
request = api.swarming.task_request()
return request.with_slice(0, request[0].
with_command(['echo', 'hi']).
with_dimensions(pool='example.pool', os='Debian'))
with api.context(realm='some:realm'):
request = basic_request().with_resultdb()
api.assertions.assertEqual('some:realm', request.realm)
request.to_jsonish() # doesn't blow up
with api.context(realm=''):
request = basic_request().with_resultdb()
api.assertions.assertEqual(None, request.realm)
res = request.to_jsonish()
# Picks up builder's realm.
api.assertions.assertEqual('proj:buck', res['realm'])
def GenTests(api):
yield (
api.test('basic') +
api.buildbucket.ci_build(project='proj', bucket='buck') +
api.post_process(DropExpectation))