def test_nonexist_bucket_delete(self, mcg_obj, interface):
     """
     Negative test with deletion of non-exist OBC.
     """
     name = "test_nonexist_bucket_name"
     if interface == "S3":
         try:
             s3_del = mcg_obj.s3_resource.Bucket(name).delete()
             assert not s3_del, (
                 "Unexpected s3 delete non-exist OBC succeed")
         except botocore.exceptions.ClientError as err:
             assert "NoSuchBucket" in str(err), (
                 "Couldn't verify delete non-exist OBC with s3")
     elif interface == "OC":
         try:
             oc_del = OCP(
                 kind='obc',
                 namespace=mcg_obj.namespace).delete(resource_name=name)
             assert oc_del, "Unexpected oc delete non-exist OBC succeed"
         except CommandFailed as err:
             assert "NotFound" in str(err), (
                 "Couldn't verify delete non-exist OBC with oc")
     elif interface == "CLI":
         try:
             cli_del = run_mcg_cmd(f'obc delete {name}')
             assert cli_del, "Unexpected cli delete non-exist OBC succeed"
         except CommandFailed as err:
             assert "Could not delete OBC" in str(err), (
                 "Couldn't verify delete non-exist OBC with cli")
     logger.info(f"Delete non-exist OBC {name} failed as expected")
Exemple #2
0
    def cli_list_all_bucket_names(self):
        """
        Returns:
            list: A list of all bucket names

        """
        obc_lst = run_mcg_cmd('obc list').split('\n')[1:-1]
        return [row.split()[1] for row in obc_lst]
Exemple #3
0
    def cli_get_all_bucket_names(self):
        """
        Returns:
            set: A set of all bucket names

        """
        obc_lst = run_mcg_cmd('obc list').split('\n')[1:-1]
        # TODO assert the bucket passed the Pending state
        return {row.split()[1] for row in obc_lst}
Exemple #4
0
 def internal_delete(self):
     """
     Deletes the bucket using the NooBaa CLI
     """
     run_mcg_cmd(f'obc delete {self.name}')
Exemple #5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     run_mcg_cmd(f'obc create --exact {self.name}')