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)
class TestBoolean(unittest.TestCase): def setUp(self): self.account_client = AccountClient() self.rse_client = RSEClient() self.account = generate_uuid()[:10] self.rse = rse_name_generator() self.account_client.add_account(self.account, 'SERVICE', '*****@*****.**') self.rse_client.add_rse(self.rse) def tearDown(self): self.account_client.delete_account(self.account) self.rse_client.delete_rse(self.rse) def test_booleanstring_account_attribute(self): self.account_client.add_account_attribute(self.account, 'teststringtrue', 'true') self.account_client.add_account_attribute(self.account, 'testinttrue', '1') self.account_client.add_account_attribute(self.account, 'teststringfalse', 'false') self.account_client.add_account_attribute(self.account, 'testintfalse', '0') result = {} for account in self.account_client.list_account_attributes( self.account): for res in account: result[res['key']] = res['value'] assert result['teststringtrue'] is True assert result['testinttrue'] == '1' assert result['teststringfalse'] is False assert result['testintfalse'] == '0' def test_booleanstring_rse_attribute(self): self.rse_client.add_rse_attribute(self.rse, 'teststringtrue', 'true') self.rse_client.add_rse_attribute(self.rse, 'testinttrue', '1') self.rse_client.add_rse_attribute(self.rse, 'teststringfalse', 'false') self.rse_client.add_rse_attribute(self.rse, 'testintfalse', '0') result = self.rse_client.list_rse_attributes(self.rse) assert result['teststringtrue'] is True assert result['testinttrue'] == '1' assert result['teststringfalse'] is False assert result['testintfalse'] == '0'
"read": 1, "write": 1, "delete": 1 } } } try: p = rseclient.add_protocol(rse_name, params) # p is true on success print('Added protocol to Theta %s' % p) except Duplicate: print('Protocol existed on Theta') #result = rseclient.add_rse_attribute(rse = rse_name, key = 'naming_convention', value = 'surl') # This is the value for relative SURL result = rseclient.add_rse_attribute( rse=rse_name, key='globus_endpoint_id', value='08925f04-569f-11e7-bef8-22000b9a448b') result = rseclient.add_rse_attribute(rse=rse_name, key='lfn2pfn_algorithm', value='cmstfc') #result = rseclient.add_rse_attribute(rse = rse_name, key = 'istape', value = False) rse_name = 'T3_US_NERSC' prefix = '/global/cscratch1/sd/uscms/rucio/cms//store/test/rucio/int/' params = { 'scheme': 'globus', 'prefix': prefix, 'impl': 'rucio.rse.protocols.globus.GlobusRSEProtocol', 'third_party_copy': 1, 'domains': {