def setUpClass(cls): if config_get_bool('common', 'multi_vo', raise_exception=False, default=False): cls.vo = {'vo': config_get('client', 'vo', raise_exception=False, default='tst')} cls.new_vo = {'vo': 'new'} cls.multi_vo = True if not vo_exists(**cls.new_vo): add_vo(description='Test', email='*****@*****.**', **cls.new_vo) else: cls.vo = {} cls.new_vo = {} cls.multi_vo = False # Add test account cls.account_name = ''.join(random.choice(string.ascii_lowercase) for x in range(10)) add_account(account=cls.account_name, type='user', email='*****@*****.**', issuer='root', **cls.vo) cls.account = InternalAccount(cls.account_name, **cls.vo) # Add test scope cls.scope_name = ''.join(random.choice(string.ascii_lowercase) for x in range(10)) add_scope(scope=cls.scope_name, account=cls.account_name, issuer='root', **cls.vo) cls.scope = InternalScope(cls.scope_name, **cls.vo) # Get test RSEs cls.rse_name = 'MOCK' cls.rse_id = get_rse_id(rse=cls.rse_name, **cls.vo) cls.rse2_name = 'MOCK2' cls.rse2_id = get_rse_id(rse=cls.rse2_name, **cls.vo) cls.rse3_name = rse_name_generator() cls.rse3_id = api_rse.add_rse(cls.rse3_name, 'root', **cls.new_vo) cls.rse4_name = rse_name_generator() cls.rse4_id = api_rse.add_rse(cls.rse4_name, 'root', **cls.new_vo) api_rse.add_distance(cls.rse3_name, cls.rse4_name, issuer='root', distance=3, **cls.new_vo)
def POST(self, account, scope): """ Creates scope with given scope name. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param Rucio-Auth-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :params Rucio-Account: account belonging to the new scope. """ try: add_scope(scope, account, issuer=ctx.env.get('issuer')) except Duplicate as error: raise generate_http_error(409, 'Duplicate', error.args[0]) except AccountNotFound as error: raise generate_http_error(404, 'AccountNotFound', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error) raise Created()
def post(self, account, scope): """ create scope with given scope name. .. :quickref: Scope; Add to account. :param account: The account identifier. :param scope: The scope to be added. :status 201: Successfully added. :status 401: Invalid auth token. :status 404: Account not found. :status 409: Scope already exists. :status 500: Database exception. """ try: add_scope(scope, account, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except AccessDenied as error: return generate_http_error_flask(401, 'AccessDenied', error.args[0]) except Duplicate as error: return generate_http_error_flask(409, 'Duplicate', error.args[0]) except AccountNotFound as error: return generate_http_error_flask(404, 'AccountNotFound', error.args[0]) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) return str(error), 500 return 'Created', 201
def test_update_new_dids(self): """ DATA IDENTIFIERS (API): List new identifiers and update the flag new """ tmp_scope = scope_name_generator() tmp_dsn = 'dsn_%s' % generate_uuid() scope.add_scope(tmp_scope, 'jdoe', 'jdoe') dids = [] for i in xrange(0, 5): d = { 'scope': tmp_scope, 'name': '%s-%i' % (tmp_dsn, i), 'did_type': DIDType.DATASET } did.add_did(scope=tmp_scope, name='%s-%i' % (tmp_dsn, i), type='DATASET', issuer='root') dids.append(d) st = did.set_new_dids(dids, None) assert_true(st) with assert_raises(DataIdentifierNotFound): did.set_new_dids([{ 'scope': 'dummyscope', 'name': 'dummyname', 'did_type': DIDType.DATASET }], None)
def post(self, account, scope): """ create scope with given scope name. .. :quickref: Scope; Add to account. :param account: The account identifier. :param scope: The scope to be added. :status 201: Successfully added. :status 401: Invalid auth token. :status 404: Account not found. :status 409: Scope already exists. """ try: add_scope(scope, account, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except InvalidObject as error: return generate_http_error_flask(400, error) except AccessDenied as error: return generate_http_error_flask(401, error) except Duplicate as error: return generate_http_error_flask(409, error) except AccountNotFound as error: return generate_http_error_flask(404, error) return 'Created', 201
def post(self, account, scope): """Add a new scope. .. :quickref: Scopes; Add a new scope. :resheader Location: post url :status 201: scope created :status 404: account does not exist :status 401: unauthorized :status 409: scope already exists :status 500: internal server error """ try: add_scope(scope, account, issuer=request.environ.get('issuer')) except Duplicate as error: return generate_http_error_flask(409, 'Duplicate', error.args[0]) except AccountNotFound as error: return generate_http_error_flask(404, 'AccountNotFound', error.args[0]) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: return error, 500 return "OK", 201
def createScope(): for i in xrange(0, 2000): print i user = '******' % (i) try: add_account(user, 'user', 'root') add_scope('user.%s' % (user), user, 'root') except Duplicate, e: print e
def createScope(): for i in range(2000): print(i) user = '******' % (i) try: add_account(user, 'user', 'root') add_scope('user.%s' % user, user, 'root') except Duplicate as e: print(e)
def post(self, account, scope): """ --- summary: Create scope description: Creates a scopse with the given name for an account. tags: - Account parameters: - name: account in: path description: The account identifier. schema: type: string style: simple - name: scope in: path description: The scope name. schema: type: string style: simple responses: 201: description: OK content: application/json: schema: type: string enum: ["Created"] 400: description: Not acceptable 401: description: Invalid Auth Token 404: description: No account found. 409: description: Scope already exists. """ try: add_scope(scope, account, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except InvalidObject as error: return generate_http_error_flask(400, error) except AccessDenied as error: return generate_http_error_flask(401, error) except Duplicate as error: return generate_http_error_flask(409, error) except AccountNotFound as error: return generate_http_error_flask(404, error) return 'Created', 201
def createScope(): # add_account('panda', 'user', 'root') # add_account('tier0', 'user', 'root') # add_scope('data12_8TeV', 'root', 'root') add_scope('mc12_8TeV', 'root', 'root') for i in xrange(0, 20): print i group = 'group%i' % (i) try: add_account(group, 'user', 'root') add_scope('group.%s' % (group), group, 'root') except Duplicate, e: print e
def test_api_subscription(self): """ SUBSCRIPTION (API): Test external representation of subscriptions """ sub = 'ext_' + generate_uuid() did = 'ext_' + generate_uuid() new_acc_name = ''.join(random.choice(string.ascii_lowercase) for x in range(10)) new_scope_name = ''.join(random.choice(string.ascii_lowercase) for x in range(10)) add_account(new_acc_name, 'USER', '*****@*****.**', 'root', **self.new_vo) add_scope(new_scope_name, new_acc_name, 'root', **self.new_vo) api_acc_lim.set_local_account_limit(new_acc_name, self.rse3_name, 10, 'root', **self.new_vo) api_acc_lim.set_local_account_limit(new_acc_name, self.rse4_name, 10, 'root', **self.new_vo) add_did(new_scope_name, did, 'DATASET', 'root', account=new_acc_name, rse=self.rse3_name, **self.new_vo) sub_id = add_subscription(sub, new_acc_name, {'account': [new_acc_name], 'scope': [new_scope_name]}, [{'copies': 1, 'rse_expression': self.rse3_name, 'weight': 0, 'activity': 'User Subscriptions', 'source_replica_expression': self.rse4_name}], '', False, 0, 0, 3, 'root', **self.new_vo) add_replication_rule(dids=[{'scope': new_scope_name, 'name': did}], copies=1, rse_expression=self.rse3_name, weight=None, lifetime=180, grouping='DATASET', account=new_acc_name, locked=False, subscription_id=sub_id, source_replica_expression=self.rse4_name, activity='User Subscriptions', notify=None, purge_replicas=False, ignore_availability=False, comment='', ask_approval=False, asynchronous=False, priority=0, split_container=False, meta='', issuer='root', **self.new_vo) out = list_subscriptions(sub, **self.new_vo) out = list(out) assert_not_equal(0, len(out)) assert_in(sub_id, [o['id'] for o in out]) for o in out: if o['id'] == sub_id: assert_equal(o['account'], new_acc_name) rules = loads(o['replication_rules'])[0] assert_equal(rules['rse_expression'], self.rse3_name) assert_equal(rules['source_replica_expression'], self.rse4_name) fil = loads(o['filter']) assert_equal(fil['account'], [new_acc_name]) assert_equal(fil['scope'], [new_scope_name]) out = list_subscription_rule_states(sub, **self.new_vo) out = list(out) assert_not_equal(0, len(out)) for o in out: assert_equal(o.account, new_acc_name) out = get_subscription_by_id(sub_id, **self.new_vo) assert_equal(out['account'], new_acc_name) rules = loads(out['replication_rules'])[0] assert_equal(rules['rse_expression'], self.rse3_name) assert_equal(rules['source_replica_expression'], self.rse4_name) fil = loads(out['filter']) assert_equal(fil['account'], [new_acc_name]) assert_equal(fil['scope'], [new_scope_name])
def test_list_new_dids(self): """ DATA IDENTIFIERS (API): List new identifiers """ tmp_scope = scope_name_generator() tmp_dsn = 'dsn_%s' % generate_uuid() scope.add_scope(tmp_scope, 'jdoe', 'jdoe', **self.vo) for i in range(0, 5): did.add_did(scope=tmp_scope, name='%s-%i' % (tmp_dsn, i), type='DATASET', issuer='root', **self.vo) for i in did.list_new_dids('DATASET', **self.vo): assert i != {} assert str(i['did_type']) == 'DATASET' break for i in did.list_new_dids(**self.vo): assert i != {} break
def test_list_new_dids(self): """ DATA IDENTIFIERS (API): List new identifiers """ tmp_scope = scope_name_generator() tmp_dsn = 'dsn_%s' % generate_uuid() scope.add_scope(tmp_scope, 'jdoe', 'jdoe') for i in range(0, 5): did.add_did(scope=tmp_scope, name='%s-%i' % (tmp_dsn, i), type='DATASET', issuer='root') for i in did.list_new_dids('DATASET'): assert_not_equal(i, {}) assert_equal(str(i['did_type']), 'DATASET') break for i in did.list_new_dids(): assert_not_equal(i, {}) break
def test_super_root_permissions(self): """ MULTI VO (CORE): Test super_root cannot access root/user functions """ rse_str = ''.join(choice(ascii_uppercase) for x in range(10)) rse_name = 'MOCK_%s' % rse_str scope_uuid = str(generate_uuid()).lower()[:16] scope = 'mock_%s' % scope_uuid # Test super_root@def with functions at vo='def' with assert_raises(AccessDenied): add_rse(rse_name, 'super_root', vo='def') with assert_raises(AccessDenied): add_scope(scope, 'root', 'super_root', vo='def') add_scope(scope, 'super_root', 'super_root', vo='def') assert_in(scope, [s for s in list_scopes(filter={}, vo='def')])
def test_update_new_dids(self): """ DATA IDENTIFIERS (API): List new identifiers and update the flag new """ tmp_scope = scope_name_generator() tmp_dsn = 'dsn_%s' % generate_uuid() scope.add_scope(tmp_scope, 'jdoe', 'jdoe') dids = [] for i in xrange(0, 5): d = {'scope': tmp_scope, 'name': '%s-%i' % (tmp_dsn, i), 'did_type': DIDType.DATASET} did.add_did(scope=tmp_scope, name='%s-%i' % (tmp_dsn, i), type='DATASET', issuer='root') dids.append(d) st = did.set_new_dids(dids, None) assert_true(st) with assert_raises(DataIdentifierNotFound): did.set_new_dids([{'scope': 'dummyscope', 'name': 'dummyname', 'did_type': DIDType.DATASET}], None)
def test_list_new_dids(self): """ DATA IDENTIFIERS (API): List new identifiers """ tmp_scope = scope_name_generator() tmp_dsn = 'dsn_%s' % generate_uuid() scope.add_scope(tmp_scope, 'jdoe', 'jdoe') for i in xrange(0, 5): did.add_did(scope=tmp_scope, name='%s-%i' % (tmp_dsn, i), type='DATASET', issuer='root') for i in did.list_new_dids('DATASET'): assert_not_equal(i, {}) assert_equal(str(i['did_type']), 'DATASET') break for i in did.list_new_dids(): assert_not_equal(i, {}) break
def post(self, account, scope): """Add a new scope. .. :quickref: Scopes; Add a new scope. :resheader Location: post url :status 201: scope created :status 404: account does not exist :status 401: unauthorized :status 409: scope already exists :status 500: internal server error """ try: add_scope(scope, account, issuer=request.environ.get('issuer')) except Duplicate, e: return generate_http_error_flask(409, 'Duplicate', e.args[0][0])
def post(self, account, scope): """ --- summary: Add Scope description: Adds a new scope. tags: - Scopes parameters: - name: account in: path description: The account associated with the scope. schema: type: string style: simple - name: scope in: path description: The name of the scope. schema: type: string style: simple responses: 201: description: OK content: application/json: schema: type: string enum: ["Created"] 401: description: Invalid Auth Token 404: description: Account not found 409: description: Scope already exists """ try: add_scope(scope, account, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except Duplicate as error: return generate_http_error_flask(409, error) except AccountNotFound as error: return generate_http_error_flask(404, error) return 'Created', 201
def test_scopes_at_different_vos(self): """ MULTI VO (CLIENT): Test that scopes from 2nd vo don't interfere """ scope_client = ScopeClient() scope_uuid = str(generate_uuid()).lower()[:16] tst = 'tst_%s' % scope_uuid new = 'new_%s' % scope_uuid shr = 'shr_%s' % scope_uuid scope_client.add_scope('root', tst) scope_client.add_scope('root', shr) add_scope(new, 'root', 'root', **self.new_vo) add_scope(shr, 'root', 'root', **self.new_vo) scope_list_tst = list(scope_client.list_scopes()) scope_list_new = list(list_scopes(filter={}, **self.new_vo)) assert_true(tst in scope_list_tst) assert_false(new in scope_list_tst) assert_true(shr in scope_list_tst) assert_false(tst in scope_list_new) assert_true(new in scope_list_new) assert_true(shr in scope_list_new)
def test_automatix(self): """ MULTI VO (DAEMON): Test that automatix runs on a single VO """ scope_client = ScopeClient() scope_uuid = str(generate_uuid()).lower()[:16] shr_scope = 'shr_%s' % scope_uuid scope_client.add_scope('root', shr_scope) add_scope(shr_scope, 'root', 'root', **self.new_vo) rse_client = RSEClient() rse_str = ''.join(choice(ascii_uppercase) for x in range(10)) shr_rse = 'SHR_%s' % rse_str mock_protocol = {'scheme': 'MOCK', 'hostname': 'localhost', 'port': 123, 'prefix': '/test/automatix', 'impl': 'rucio.rse.protocols.mock.Default', 'domains': { 'lan': {'read': 1, 'write': 1, 'delete': 1}, 'wan': {'read': 1, 'write': 1, 'delete': 1}}} rse_client.add_rse(shr_rse) rse_client.add_rse_attribute(rse=shr_rse, key='verify_checksum', value=False) rse_client.add_protocol(shr_rse, mock_protocol) add_rse(shr_rse, 'root', **self.new_vo) add_rse_attribute(rse=shr_rse, key='verify_checksum', value=False, issuer='root', **self.new_vo) add_protocol(rse=shr_rse, data=mock_protocol, issuer='root', **self.new_vo) automatix(sites=[shr_rse], inputfile='/opt/rucio/etc/automatix.json', sleep_time=30, account='root', once=True, scope=shr_scope) did_list_tst = list(DIDClient().list_dids(shr_scope, {})) did_list_new = list(list_dids(shr_scope, {}, **self.new_vo)) assert_not_equal(len(did_list_tst), 0) assert_equal(len(did_list_new), 0) did_dicts = [{'scope': shr_scope, 'name': n} for n in did_list_tst] replicas_tst = list(ReplicaClient().list_replicas(did_dicts, rse_expression=shr_rse)) replicas_new = list(list_replicas(did_dicts, rse_expression=shr_rse, **self.new_vo)) assert_not_equal(len(replicas_tst), 0) assert_equal(len(replicas_new), 0)
def POST(self, account, scope): """ create scope with given scope name. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param Rucio-Auth-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :params Rucio-Account: account belonging to the new scope. """ try: add_scope(scope, account, issuer=ctx.env.get('issuer')) except AccessDenied, e: raise generate_http_error(401, 'AccessDenied', e.args[0][0])
def POST(self, account, scope): """ Creates scope with given scope name. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param Rucio-Auth-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :params Rucio-Account: account belonging to the new scope. """ try: add_scope(scope, account) except Duplicate, e: raise generate_http_error(409, 'Duplicate', e.args[0][0])
def post(self, account, scope): """Add a new scope. .. :quickref: Scopes; Add a new scope. :resheader Location: post url :status 201: scope created :status 404: account does not exist :status 401: unauthorized :status 409: scope already exists """ try: add_scope(scope, account, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except Duplicate as error: return generate_http_error_flask(409, error) except AccountNotFound as error: return generate_http_error_flask(404, error) return 'Created', 201
def test_dids_at_different_vos(self): """ MULTI VO (CLIENT): Test that dids from 2nd vo don't interfere """ scope_uuid = str(generate_uuid()).lower()[:16] scope = 'shr_%s' % scope_uuid add_scope(scope, 'root', 'root', **self.vo) add_scope(scope, 'root', 'root', **self.new_vo) did_client = DIDClient() did_uuid = str(generate_uuid()).lower()[:16] tst = 'tstset_%s' % did_uuid new = 'newset_%s' % did_uuid shr = 'shrset_%s' % did_uuid did_client.add_did(scope, tst, 'DATASET') did_client.add_did(scope, shr, 'DATASET') add_did(scope, new, 'DATASET', 'root', **self.new_vo) add_did(scope, shr, 'DATASET', 'root', **self.new_vo) did_list_tst = list(did_client.list_dids(scope, {})) did_list_new = list(list_dids(scope, {}, **self.new_vo)) assert_true(tst in did_list_tst) assert_false(new in did_list_tst) assert_true(shr in did_list_tst) assert_false(tst in did_list_new) assert_true(new in did_list_new) assert_true(shr in did_list_new)
def create_scope(scope): add_scope(scope, 'root', 'root') set_account_limit('root', get_rse_id('PSDM_DISK'), 100000000000)
parser = argparse.ArgumentParser(description='Rucio functional tests.') parser.add_argument('scope', type=str, help='scope to use, creates it if it does not exist') parser.add_argument('-r', '--repeat', metavar='repeat', type=int, default=1, help='how many time to repeat the block (default: 1)') parser.add_argument('-p', '--parallel', metavar='parallel', type=int, default=1, help='how many parallel instances process should be executed (default: 1)') args = parser.parse_args() print datetime.datetime.now().strftime('Starting functional test at %Y-%m-%d %H:%M') print "Scope: %s" % args.scope try: add_scope(args.scope, 'root', 'root') print "Created scope" except Duplicate as ex: print "Could not create scope: %s" % ex VARIABLEHASH['SCOPE'] = args.scope # create the folder to write logs if not os.path.exists(os.path.join(LOG_PATH, args.scope)): os.makedirs(os.path.join(LOG_PATH, args.scope)) # run the simulation with as much processes as was configured by the user for p in xrange(args.parallel): p = threading.Thread(target=run_simulation, args=(args.scope, p, args.repeat)) processes.append(p) p.start()
import os from rucio.api.account import add_account from rucio.api.identity import add_account_identity from rucio.api.scope import add_scope from rucio.api.did import add_did from rucio.api.rse import add_rse, add_distance from rucio.db.sqla.util import build_database, create_root_account from rucio.core.account_limit import set_account_limit from rucio.core.rse import add_protocol, get_rse_id, add_rse_attribute if __name__ == '__main__': #build database build_database() # create root account create_root_account() add_account_identity('/CN=docker client', 'x509', 'root', '*****@*****.**', issuer="root") # create gfronze account add_account('gfronze', 'USER', 'test', 'root') # create some scopes add_scope('user.gfronze', 'gfronze', 'root') add_scope('user.root', 'root', 'root') add_scope('tests', 'root', 'root')
def test_subscriptions_at_different_vos(self): """ MULTI VO (CLIENT): Test that subscriptions from 2nd vo don't interfere """ account_client = AccountClient() usr_uuid = str(generate_uuid()).lower()[:16] shr_acc = 'shr-%s' % usr_uuid account_client.add_account(shr_acc, 'USER', '*****@*****.**') add_account(shr_acc, 'USER', '*****@*****.**', 'root', **self.new_vo) scope_client = ScopeClient() scope_uuid = str(generate_uuid()).lower()[:16] tst_scope = 'tst_%s' % scope_uuid new_scope = 'new_%s' % scope_uuid scope_client.add_scope('root', tst_scope) add_scope(new_scope, 'root', 'root', **self.new_vo) did_client = DIDClient() did_uuid = str(generate_uuid()).lower()[:16] tst_did = 'tstset_%s' % did_uuid new_did = 'newset_%s' % did_uuid rse_client = RSEClient() rse_str = ''.join(choice(ascii_uppercase) for x in range(10)) tst_rse1 = 'TST1_%s' % rse_str tst_rse2 = 'TST2_%s' % rse_str new_rse1 = 'NEW1_%s' % rse_str new_rse2 = 'NEW2_%s' % rse_str rse_client.add_rse(tst_rse1) rse_client.add_rse(tst_rse2) add_rse(new_rse1, 'root', **self.new_vo) add_rse(new_rse2, 'root', **self.new_vo) acc_lim_client = AccountLimitClient() acc_lim_client.set_local_account_limit(shr_acc, tst_rse1, 10) acc_lim_client.set_local_account_limit(shr_acc, tst_rse2, 10) set_local_account_limit(shr_acc, new_rse1, 10, 'root', **self.new_vo) set_local_account_limit(shr_acc, new_rse2, 10, 'root', **self.new_vo) did_client.add_did(tst_scope, tst_did, 'DATASET', rse=tst_rse1) add_did(new_scope, new_did, 'DATASET', 'root', rse=new_rse1, **self.new_vo) sub_client = SubscriptionClient() sub_str = generate_uuid() tst_sub = 'tstsub_' + sub_str new_sub = 'newsub_' + sub_str shr_sub = 'shrsub_' + sub_str tst_sub_id = sub_client.add_subscription(tst_sub, shr_acc, {'scope': [tst_scope]}, [{'copies': 1, 'rse_expression': tst_rse2, 'weight': 0, 'activity': 'User Subscriptions'}], '', None, 0, 0) shr_tst_sub_id = sub_client.add_subscription(shr_sub, shr_acc, {'scope': [tst_scope]}, [{'copies': 1, 'rse_expression': tst_rse2, 'weight': 0, 'activity': 'User Subscriptions'}], '', None, 0, 0) new_sub_id = add_subscription(new_sub, shr_acc, {'scope': [new_scope]}, [{'copies': 1, 'rse_expression': new_rse2, 'weight': 0, 'activity': 'User Subscriptions'}], '', False, 0, 0, 3, 'root', **self.new_vo) shr_new_sub_id = add_subscription(shr_sub, shr_acc, {'scope': [new_scope]}, [{'copies': 1, 'rse_expression': new_rse2, 'weight': 0, 'activity': 'User Subscriptions'}], '', False, 0, 0, 3, 'root', **self.new_vo) tst_subs = [s['id'] for s in sub_client.list_subscriptions()] assert_in(tst_sub_id, tst_subs) assert_in(shr_tst_sub_id, tst_subs) assert_not_in(new_sub_id, tst_subs) assert_not_in(shr_new_sub_id, tst_subs) new_subs = [s['id'] for s in list_subscriptions(**self.new_vo)] assert_in(new_sub_id, new_subs) assert_in(shr_new_sub_id, new_subs) assert_not_in(tst_sub_id, new_subs) assert_not_in(shr_tst_sub_id, new_subs) shr_tst_subs = [s['id'] for s in sub_client.list_subscriptions(name=shr_sub)] assert_in(shr_tst_sub_id, shr_tst_subs) assert_not_in(shr_new_sub_id, shr_tst_subs) shr_new_subs = [s['id'] for s in list_subscriptions(name=shr_sub, **self.new_vo)] assert_in(shr_new_sub_id, shr_new_subs) assert_not_in(shr_tst_sub_id, shr_new_subs) acc_tst_subs = [s['id'] for s in sub_client.list_subscriptions(account=shr_acc)] assert_in(tst_sub_id, acc_tst_subs) assert_in(shr_tst_sub_id, acc_tst_subs) assert_not_in(new_sub_id, acc_tst_subs) assert_not_in(shr_new_sub_id, acc_tst_subs) acc_new_subs = [s['id'] for s in list_subscriptions(account=shr_acc, **self.new_vo)] assert_in(new_sub_id, acc_new_subs) assert_in(shr_new_sub_id, acc_new_subs) assert_not_in(tst_sub_id, acc_new_subs) assert_not_in(shr_tst_sub_id, acc_new_subs)
if __name__ == '__main__': # Create the Database and the root account build_database() create_root_account() add_account_identity('/CN=docker client', 'x509', 'root', '*****@*****.**', issuer="root") # Create a user called jdoe add_account('jdoe', 'USER', 'test', 'root') # Add 2 scopes add_scope('user.jdoe', 'jdoe', 'root') add_scope('tests', 'root', 'root') # Create a test dataset for jdoe add_did('user.jdoe', 'test1', 'DATASET', 'root', account='jdoe') # Create 2 sites into the /tmp partition os.mkdir('/tmp/SITE2_DISK') os.mkdir('/tmp/SITE1_DISK') params = { 'scheme': 'file', 'prefix': '/tmp/SITE1_DISK/', 'impl': 'rucio.rse.protocols.posix.Default', 'domains': { "lan": {