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_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 parse(textpb): return text_format.Merge(textpb, pools_pb2.BotMonitoring())
), ], default_external_services=pools_pb2.ExternalServices( isolate=pools_pb2.ExternalServices.Isolate( server='https://isolate.server.example.com', namespace='default-gzip', ), cipd=pools_pb2.ExternalServices.CIPD( server='https://cipd.server.example.com', client_package=config_pb2.CipdPackage( package_name='some-cipd-client', version='latest', ), )), bot_monitoring=[ pools_pb2.BotMonitoring(name='bots', dimension_key=['os', 'bool']), ], ) class PoolsConfigTest(test_case.TestCase): def validator_test(self, cfg, messages): ctx = validation.Context() pools_config._validate_pools_cfg(cfg, ctx) self.assertEquals(ctx.result().messages, [ validation.Message(severity=logging.ERROR, text=m) for m in messages ]) def mock_config(self, cfg): def get_self_config_mock(path, cls=None, **kwargs):