Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing deleting procedure for the ceph FS #10148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
moving test to new location
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
  • Loading branch information
shivamdurgbuns committed Sep 20, 2024
commit f021987c2b59d39e023f8fbf5172050c2702778b
59 changes: 59 additions & 0 deletions tests/functional/pv/pv_services/test_cephfilesystem_creation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import logging
import pytest

from ocs_ci.helpers.helpers import (
create_ceph_file_system,
)
from ocs_ci.ocs.exceptions import CommandFailed
from ocs_ci.framework.testlib import ManageTest
from ocs_ci.framework.pytest_customization.marks import (
tier2,
green_squad,
)

logger = logging.getLogger(__name__)


class TestCephFileSystemCreation(ManageTest):
"""
Testing Creation of a filesystem and checking its existence.
Also checking if the same filesystem can't be created twice.
"""

@tier2
@green_squad
@pytest.mark.polarion_id("OCS-5793")
def test_Cephfilesystem_creation(self):
"""
Trying to create more cephfilesystem using the same name.
Expected Result: It should not create the filesystem and throw error.
"""
logger.info("Starting test of Ceph Filesystem Creation")
try:
cephFS_obj = create_ceph_file_system(
cephfs_name="test-ceph-fs", label={"use": "test"}
)

if cephFS_obj:
logger.info("CephFile System Created. : test-ceph-fs")
else:
logger.error("Unable to create the Ceph File System")
logger.info("Deleting the Cephf Filesystem")
cephFS_obj.delete()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After cephFS_obj.delete(), I think we should add a check to wait for Pod removal before adding it again. Probably that's the leftover Pod being reported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivamdurgbuns Please verify that the cephfilesystem is actually deleted.

cephFS_obj.ocp.wait_for_delete(
                cephFS_obj.name
            )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay will check it out

logger.info("Creating CephFileSystem in the namespace")
new_cephFS_obj = create_ceph_file_system(
cephfs_name="test-ceph-fs", label={"use": "test"}
)
logger.info(
f"Not able to create a new ceph fs using same name {new_cephFS_obj.name}"
)

except CommandFailed as e:
if "Error from server (AlreadyExists)" in str(e):
logger.info("Test success!")
assert "Error from server (AlreadyExists)" in str(e)
else:
logger.error(
f"Command Failed, while creating the ceph file system.\n{str(e)}"
)
raise CommandFailed