Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: scripts/slave/recipe_modules/chromite/example.py

Issue 1345143004: CrOS: Use local Chromite checkout for configs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Rebased, comments, more useful expectations. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/chromite/example.py
diff --git a/scripts/slave/recipe_modules/chromite/example.py b/scripts/slave/recipe_modules/chromite/example.py
index 649f9dbe7a20d2c20550752ad2b8e6078ebc92b1..b914cbfa02472809138bd1d3f1bb19cb82f91fd2 100644
--- a/scripts/slave/recipe_modules/chromite/example.py
+++ b/scripts/slave/recipe_modules/chromite/example.py
@@ -4,9 +4,26 @@
DEPS = [
'chromite',
+ 'gitiles',
]
+_TEST_CONFIG = {
+ '_default': {
+ 'foo': 'bar',
+ 'baz': 'qux',
+ },
+ '_templates': {
+ 'woot': {
+ 'baz': 'templated',
+ }
+ },
+ 'myconfig': {
+ '_template': 'woot',
+ 'local': 'variable',
+ },
+}
+
def RunSteps(api):
api.chromite.set_config('base')
@@ -19,6 +36,27 @@ def RunSteps(api):
api.chromite.cbuildbot('cbuildbot', 'amd64-generic-full',
args=['--clobber', '--build-dir', '/here/there'])
+ # Exercise valid configuraiton.
+ config = api.chromite.load_config('myconfig')
+ assert config is not None
+ assert config['foo'] == 'bar'
+ assert config['baz'] == 'templated'
+ assert config['local'] == 'variable'
+ assert config.get('invalid') is None
+
+ raised = False
+ try:
+ config['invalid']
+ except KeyError:
+ raised = True
+ assert raised, 'Did not raise KeyError!'
+
+ # Exercise invalid configuration.
+ assert api.chromite.load_config('nonexistent') is None
+
def GenTests(api):
- yield api.test('basic')
+ yield (api.test('basic') +
+ api.chromite.seed_chromite_config(_TEST_CONFIG)
+ )
+
« no previous file with comments | « scripts/slave/recipe_modules/chromite/config.py ('k') | scripts/slave/recipe_modules/chromite/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698