Skip to content

Commit

Permalink
setup functions need to be run before we can check if content version…
Browse files Browse the repository at this point in the history
…ing should be enforced
  • Loading branch information
cmcginley-splunk committed Oct 8, 2024
1 parent 35ece19 commit 21520bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def setup(self):
self.start_time = time.time()

# Init the list of setup functions we always need
setup_functions: list[tuple[Callable[[], None | client.Service], str]] = [
primary_setup_functions: list[tuple[Callable[[], None | client.Service], str]] = [
(self.start, "Starting"),
(self.get_conn, "Waiting for App Installation"),
(self.configure_conf_file_datamodels, "Configuring Datamodels"),
Expand All @@ -142,18 +142,13 @@ def setup(self):
(self.configure_imported_roles, "Configuring Roles"),
(self.configure_delete_indexes, "Configuring Indexes"),
(self.configure_hec, "Configuring HEC"),
(self.wait_for_ui_ready, "Finishing Primary Setup")
]

# Add any setup functions only applicable to content versioning validation
if self.should_test_content_versioning:
setup_functions = setup_functions + self.content_versioning_service.setup_functions

# Add the final setup function
setup_functions.append((self.wait_for_ui_ready, "Finishing Setup"))

# Execute and report on each setup function
try:
for func, msg in setup_functions:
# Run the primary setup functions
for func, msg in primary_setup_functions:
self.format_pbar_string(
TestReportingType.SETUP,
self.get_name(),
Expand All @@ -163,6 +158,18 @@ def setup(self):
func()
self.check_for_teardown()

# Run any setup functions only applicable to content versioning validation
if self.should_test_content_versioning:
for func, msg in self.content_versioning_service.setup_functions:
self.format_pbar_string(
TestReportingType.SETUP,
self.get_name(),
msg,
update_sync_status=True,
)
func()
self.check_for_teardown()

except Exception as e:
msg = f"[{self.get_name()}]: {str(e)}"
self.finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def get_docker_client(self):
raise (Exception(f"Failed to get docker client: {str(e)}"))

def check_for_teardown(self):

try:
container: docker.models.containers.Container = self.get_docker_client().containers.get(self.get_name())
except Exception as e:
Expand Down

0 comments on commit 21520bc

Please sign in to comment.