Exemplo n.º 1
0
 def test_cache_add_replicas_no_rse(self):
     """ RucioCache(Func): Test rucio cache add replicas to not existed rse(failed) """
     try:
         cache_add_replicas(self.rse_noExist, self.files_exist, self.account, self.lifetime)
         assert False
     except exception.RSENotFound:
         assert True
Exemplo n.º 2
0
 def test_cache_delete_replicas_no_rse(self):
     """ RucioCache(Func): Test rucio cache delete replicas on not existed rse(failed) """
     try:
         cache_add_replicas(self.rse_noExist, self.files_exist,
                            self.account, self.lifetime)
         assert False
     except exception.RSENotFound:
         assert True
Exemplo n.º 3
0
    def test_cache_add_delete_replicas(self):
        """ RucioCache(Func): Test rucio cache add and delete replicas(success) """
        ret = cache_add_replicas(self.rse_exist_volatile, self.files_exist,
                                 self.account, self.lifetime)
        assert_equal(ret, 0)

        for file in self.files_exist:
            reps = replica.get_replica(self.rse_exist_volatile, file['scope'],
                                       file['name'])
            assert_equal(len(reps) > 0, True)

        ret = cache_delete_replicas(self.rse_exist_volatile, self.files_exist,
                                    self.account)
        assert_equal(ret, 0)

        for file in self.files_exist:
            try:
                reps = replica.get_replica(self.rse_exist_volatile,
                                           file['scope'], file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False
Exemplo n.º 4
0
    def test_cache_add_replicas_file_not_exist(self):
        """ RucioCache(Func): Test rucio cache add replica with not existed file(failed) """
        ret = cache_add_replicas(self.rse_exist_volatile, self.files_noExist, self.account, self.lifetime)
        assert_equal(ret, DID_NOT_FOUND)

        for file in self.files_noExist:
            try:
                replica.get_replica(self.rse_exist_volatile, file['scope'], file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False
Exemplo n.º 5
0
    def test_cache_add_replicas_file_meta_wrong(self):
        """ RucioCache(Func): Test rucio cache add replica with wrong meta data(failed) """
        ret = cache_add_replicas(self.rse_exist_volatile, self.files_exist_wrong_meta, self.account, self.lifetime)
        assert_equal(ret, META_MISMATCH)

        for file in self.files_exist_wrong_meta:
            try:
                replica.get_replica(self.rse_exist_volatile, file['scope'], file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False
Exemplo n.º 6
0
    def test_cache_add_replicas_file_not_exist(self):
        """ RucioCache(Func): Test rucio cache add replica with not existed file(failed) """
        ret = cache_add_replicas(self.rse_exist_volatile, self.files_noExist,
                                 self.account, self.lifetime)
        assert_equal(ret, DID_NOT_FOUND)

        for file in self.files_noExist:
            try:
                replica.get_replica(self.rse_exist_volatile, file['scope'],
                                    file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False
Exemplo n.º 7
0
    def test_cache_add_replicas_file_meta_wrong(self):
        """ RucioCache(Func): Test rucio cache add replica with wrong meta data(failed) """
        ret = cache_add_replicas(self.rse_exist_volatile,
                                 self.files_exist_wrong_meta, self.account,
                                 self.lifetime)
        assert_equal(ret, META_MISMATCH)

        for file in self.files_exist_wrong_meta:
            try:
                replica.get_replica(self.rse_exist_volatile, file['scope'],
                                    file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False
Exemplo n.º 8
0
    def test_cache_add_delete_replicas(self):
        """ RucioCache(Func): Test rucio cache add and delete replicas(success) """
        ret = cache_add_replicas(self.rse_exist_volatile, self.files_exist, self.account, self.lifetime)
        assert_equal(ret, 0)

        for file in self.files_exist:
            reps = replica.get_replica(self.rse_exist_volatile, file['scope'], file['name'])
            assert_equal(len(reps) > 0, True)

        ret = cache_delete_replicas(self.rse_exist_volatile, self.files_exist, self.account)
        assert_equal(ret, 0)

        for file in self.files_exist:
            try:
                reps = replica.get_replica(self.rse_exist_volatile, file['scope'], file['name'])
                assert False
            except Exception, e:
                if "No row was found" in str(e):
                    assert True
                else:
                    assert False