def test_simple_pb(self): tt = self.parse(""" cache: { name: "hi" path: "cache/hi" } cache: { name: "there" path: "cache/there" } cipd_package: { path: "bin" pkg: "foo/bar" version: "latest" } env: {var: "VAR" value: "1"} env: {var: "PATH" prefix: "1" prefix: "2" soft: true} """) self.assertEqual( pools_config.TaskTemplate.from_pb(self.ctx, tt), pools_config.TaskTemplate( cache=( pools_config.CacheEntry('hi', 'cache/hi'), pools_config.CacheEntry('there', 'cache/there'), ), cipd_package=(pools_config.CipdPackage('bin', 'foo/bar', 'latest'), ), env=( pools_config.Env('PATH', '', ('1', '2'), True), pools_config.Env('VAR', '1', (), False), ), inclusions=frozenset()))
def mocked_fetch_pools_config(): default_isolate = pools_config.IsolateServer( server='https://pool.config.isolate.example.com', namespace='default-gzip', ) default_cipd = pools_config.CipdServer( server='https://pool.config.cipd.example.com', client_version='from_pool_config', ) return pools_config._PoolsCfg( { "template": pools_config.PoolConfig( name='template', rev='pools_cfg_rev', scheduling_users=frozenset([ # See setUp above. We just duplicate the first ACL layer here auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), ]), scheduling_groups=frozenset(), trusted_delegatees={}, service_accounts=frozenset(service_accounts), service_accounts_groups=(), task_template_deployment=pools_config. TaskTemplateDeployment( prod=pools_config.TaskTemplate( cache=(), cipd_package=(), env=(pools_config.Env('VAR', 'prod', (), False), ), inclusions=()), canary=pools_config.TaskTemplate( cache=(), cipd_package=(), env=(pools_config.Env('VAR', 'canary', (), False), ), inclusions=()), canary_chance=0.5, ), default_isolate=default_isolate, default_cipd=default_cipd, bot_monitoring=None, external_schedulers=None, ), "default": pools_config.PoolConfig( name='default', rev='pools_cfg_rev', scheduling_users=frozenset([ # See setUp above. We just duplicate the first ACL layer here auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), auth.Identity(auth.IDENTITY_USER, '*****@*****.**'), ]), scheduling_groups=frozenset(), trusted_delegatees={}, service_accounts=frozenset(service_accounts), service_accounts_groups=(), task_template_deployment=None, bot_monitoring=None, default_isolate=default_isolate, default_cipd=default_cipd, external_schedulers=None, ), }, (default_isolate, default_cipd))