def test_good_bot_monitoring(self): cfg = pools_pb2.PoolsCfg( pool=[pools_pb2.Pool(name=['abc'], bot_monitoring='mon')], bot_monitoring=[ pools_pb2.BotMonitoring(name='mon', dimension_key='a'), ]) self.validator_test(cfg, [])
def test_bad_pool_name(self): n = 'x' * 300 cfg = pools_pb2.PoolsCfg(pool=[pools_pb2.Pool(name=[n])]) self.validator_test(cfg, [ 'pool #0 (%s): bad pool name "%s", not a valid dimension value' % (n, n), ])
def test_bad_scheduling_group(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(group=['!!!'], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): bad group name "!!!"', ])
def test_unreferenced_bot_monitoring(self): cfg = pools_pb2.PoolsCfg(pool=[pools_pb2.Pool(name=['abc'])], bot_monitoring=[ pools_pb2.BotMonitoring( name='mon', dimension_key='a'), ]) self.validator_test(cfg, [ 'bot_monitoring not referred to: mon', ])
def test_missing_bot_monitoring(self): cfg = pools_pb2.PoolsCfg( pool=[pools_pb2.Pool( name=['abc'], bot_monitoring='missing', )]) self.validator_test(cfg, [ 'pool #0 (abc): refer to missing bot_monitoring u\'missing\'', ])
def test_bad_service_account_group(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool( name=['abc'], allowed_service_account_group=['!!!'], ) ]) self.validator_test(cfg, [ 'pool #0 (abc): bad allowed_service_account_group #0 "!!!"', ])
def test_bad_service_account(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool( name=['abc'], allowed_service_account=['not an email'], ) ]) self.validator_test(cfg, [ 'pool #0 (abc): bad allowed_service_account #0 "not an email"', ])
def test_no_delegatee_peer_id(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(trusted_delegation=[ pools_pb2.TrustedDelegation() ], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): trusted_delegation #0 (): "peer_id" is required', ])
def test_bad_scheduling_user(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers( user=['not valid email'], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): bad user value "not valid email" - ' 'Identity has invalid format: not valid email', ])
def test_bad_default_task_realm(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool( name=['abc'], realm='good:realm', default_task_realm='bad-realm', ) ]) self.validator_test(cfg, [ "pool #0 (abc): bad default_task_realm value: Bad realm 'bad-realm', " 'want "<project>:<name>"', ])
def test_wildcard_delegation_tag_ok(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(trusted_delegation=[ pools_pb2.TrustedDelegation( peer_id='*****@*****.**', require_any_of=pools_pb2.TrustedDelegation. TagList(tag=['k:tag1/*'], ), ) ], )), ]) self.validator_test(cfg, [])
def test_bad_delegatee_peer_id(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(trusted_delegation=[ pools_pb2.TrustedDelegation( peer_id='not valid email', ) ], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): trusted_delegation #0 (not valid email): bad peer_id ' 'value "not valid email" - Identity has invalid format: not valid email', ])
def test_duplicate_delegatee_peer_id(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(trusted_delegation=[ pools_pb2.TrustedDelegation( peer_id='*****@*****.**'), pools_pb2.TrustedDelegation( peer_id='*****@*****.**'), ], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): trusted_delegation #0 ([email protected]): peer ' '"*****@*****.**" was specified twice', ])
def test_bad_delegation_tag(self): cfg = pools_pb2.PoolsCfg(pool=[ pools_pb2.Pool(name=['abc'], schedulers=pools_pb2.Schedulers(trusted_delegation=[ pools_pb2.TrustedDelegation( peer_id='*****@*****.**', require_any_of=pools_pb2.TrustedDelegation. TagList(tag=['not kv'], ), ) ], )), ]) self.validator_test(cfg, [ 'pool #0 (abc): trusted_delegation #0 ([email protected]): bad tag #0 ' '"not kv" - must be <key>:<value>', ])
def test_missing_pool_name(self): cfg = pools_pb2.PoolsCfg(pool=[pools_pb2.Pool()]) self.validator_test(cfg, [ 'pool #0 (unnamed): at least one pool name must be given', ])
pools_pb2.Pool( name=['pool_name', 'another_name'], schedulers=pools_pb2.Schedulers( user=['user:[email protected]', '*****@*****.**'], group=['group1', 'group2'], trusted_delegation=[ pools_pb2.TrustedDelegation( peer_id='*****@*****.**', require_any_of=pools_pb2.TrustedDelegation.TagList( tag=['k:tag1', 'k:tag2'], ), ), ], ), allowed_service_account=[ '*****@*****.**', '*****@*****.**', ], allowed_service_account_group=[ 'accounts_group1', 'accounts_group2', ], realm='test:pool/realm', enforced_realm_permissions=[ realms_pb2.REALM_PERMISSION_POOLS_CREATE_TASK, ], bot_monitoring='bots', external_schedulers=[ pools_pb2.ExternalSchedulerConfig( address='externalscheduler.google.com', id='ext1', dimensions=['key1:value1', 'key2:value2'], enabled=True, allow_es_fallback=True, ) ], ),