Skip to content

Commit

Permalink
Add test for token generation with quota
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Bondarenko <[email protected]>
  • Loading branch information
ebondare committed Oct 4, 2024
1 parent aa23bc6 commit 4f31bd3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ocs_ci/ocs/ui/page_objects/storage_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self):

def generate_client_onboarding_ticket(self, quota_value=None, quota_tib=None):
"""
Generate a client onboarding ticket
Generate a client onboarding ticket.
Starting with version 4.17, client quota can be specified
Args:
quota_value (int): client's quota in GiB or TiB, unlimited if not defined
Expand All @@ -24,8 +25,10 @@ def generate_client_onboarding_ticket(self, quota_value=None, quota_tib=None):
Returns:
str: onboarding_key
"""
logger.info("Generating onboarding ticket")
self.do_click(self.storage_clients_loc["generate_client_onboarding_ticket"])
if quota_value:
logger.info("Setting client cluster quota")
self.do_click(self.storage_clients_loc["custom_quota"])
self.do_clear(
locator=self.storage_clients_loc["quota_value"],
Expand All @@ -37,7 +40,7 @@ def generate_client_onboarding_ticket(self, quota_value=None, quota_tib=None):
if quota_tib:
self.do_click(self.storage_clients_loc["choose_units"])
self.do_click(self.storage_clients_loc["quota_ti"])

logger.info("Confirming token generation")
self.do_click(self.storage_clients_loc["confirm_generation"])
onboarding_key = self.get_element_text(
self.storage_clients_loc["onboarding_key"]
Expand Down
35 changes: 35 additions & 0 deletions tests/functional/ui/test_provider_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging

from ocs_ci.ocs import constants
from ocs_ci.framework.testlib import (
skipif_ocs_version,
ManageTest,
tier1,
skipif_ocp_version,
runs_on_provider,
black_squad,
hci_provider_required,
)
from ocs_ci.ocs.ui.page_objects.page_navigator import PageNavigator


logger = logging.getLogger(__name__)


@tier1
@black_squad
@skipif_ocs_version("<4.17")
@skipif_ocp_version("<4.17")
@runs_on_provider
@hci_provider_required
class TestOnboardingTokenGenerationWithQuota(ManageTest):
"""
Test onboarding token generation when quota is specified
"""

storage_clients = PageNavigator().nav_to_storageclients_page()
token = storage_clients.generate_client_onboarding_ticket(
quota_value=2, quota_tib=True
)
logger.info(f"Token generated. It begins with {token[:20]}")
assert len(token) > 20, "Token is too short"

0 comments on commit 4f31bd3

Please sign in to comment.