Skip to content

Commit

Permalink
tests/workload_license: workload that install a license
Browse files Browse the repository at this point in the history
  • Loading branch information
andijcr committed Mar 24, 2023
1 parent 40cf877 commit a55ba9c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/rptest/tests/workload_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self, ctx) -> None:
self.first_license_check: Optional[float] = None
self.license_installed = False
self.license: Optional[str] = None
self.installed_license_timeout: Optional[float] = None

def get_earliest_applicable_release(self):
return (22, 1) # last version without the license feature
Expand Down Expand Up @@ -62,22 +63,27 @@ def partial_progress(self, versions) -> int:
return PWorkload.DONE

def progress(self, version: tuple[int, int, int]) -> int:
# skip test
if self.license is None:
return PWorkload.DONE

# just check that no log nag is present
if version[0:2] <= (22, 1):
# These logs can't exist in v22.1 but double check anyway...
assert self.ctx.redpanda.search_log_any(
"Enterprise feature(s).*") is False
return PWorkload.DONE

# license is installable
admin = Admin(self.ctx.redpanda)

assert admin.supports_feature("license")

# first license installation
if not self.license_installed:
self.first_license_check = self.first_license_check or (
time.time() + LicenseWorkload.LICENSE_CHECK_INTERVAL_SEC * 2)
# ensure that enought time passed for log nag to appear
if self.first_license_check > time.time():
return PWorkload.NOT_DONE

Expand All @@ -91,4 +97,19 @@ def progress(self, version: tuple[int, int, int]) -> int:
self.license_installed = True
return PWorkload.DONE

return PWorkload.DONE
# license was installed and this is a new version of redpanda
self.installed_license_timeout = self.installed_license_timeout or (
time.time() + 30)

assert self.installed_license_timeout >= time.time(
), "Timeout of installed license check"

# Attempt to read license written by older version
cluster_license = admin.get_license()

if cluster_license is not None and cluster_license['loaded'] is True:
self.installed_license_timeout = None # check complete for this version
return PWorkload.DONE
else:
# check needs more time
return PWorkload.NOT_DONE

0 comments on commit a55ba9c

Please sign in to comment.