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

Fix and restructure functional tests #343

Merged
merged 17 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
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
22 changes: 18 additions & 4 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
import os
import platform
from pathlib import Path

import pytest
from utils import RESOURCES_DIR, Resource
Expand Down Expand Up @@ -100,31 +102,31 @@ def resources() -> list[Resource]:
Resource(
resource_name=TPR_RESOURCES.get(HWTool.STORCLI),
file_name="storcli.deb",
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.STORCLI)[0].replace(
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.STORCLI).replace(
"collector.", ""
),
bin_name=HWTool.STORCLI.value,
),
Resource(
resource_name=TPR_RESOURCES.get(HWTool.PERCCLI),
file_name="perccli.deb",
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.PERCCLI)[0].replace(
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.PERCCLI).replace(
"collector.", ""
),
bin_name=HWTool.PERCCLI.value,
),
Resource(
resource_name=TPR_RESOURCES.get(HWTool.SAS2IRCU),
file_name="sas2ircu",
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.SAS2IRCU)[0].replace(
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.SAS2IRCU).replace(
"collector.", ""
),
bin_name=HWTool.SAS2IRCU.value,
),
Resource(
resource_name=TPR_RESOURCES.get(HWTool.SAS3IRCU),
file_name="sas3ircu",
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.SAS3IRCU)[0].replace(
collector_name=HARDWARE_EXPORTER_COLLECTOR_MAPPING.get(HWTool.SAS3IRCU).replace(
"collector.", ""
),
bin_name=HWTool.SAS3IRCU.value,
Expand All @@ -146,3 +148,15 @@ def required_resources(resources: list[Resource], provided_collectors: set) -> l
required_resources.append(resource)

return required_resources


@pytest.fixture()
def charm_path(base: str, architecture: str) -> Path:
"""Fixture to determine the charm path based on the base."""
glob_path = f"hardware-observer_*{base.replace('@', '-')}-{architecture}*.charm"
paths = list(Path(".").glob(glob_path))

if not paths:
raise FileNotFoundError(f"The path for the charm for {base}-{architecture} is not found.")

return os.getcwd() / paths[0]
rgildein marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading