Example #1
0
 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',
     ])
Example #2
0
 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',
     ])
Example #3
0
 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',
     ])
Example #4
0
 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>',
     ])
Example #5
0
from proto import pools_pb2
from server import pools_config

from google.protobuf import text_format

TEST_CONFIG = pools_pb2.PoolsCfg(pool=[
    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',
        ],
    ),
],
                                 forbid_unknown_pools=True)