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

topology: prepare for topology controller #73

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all 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
20 changes: 16 additions & 4 deletions sssd_test_framework/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
from typing import Any, Mapping, Tuple, final

import pytest
from pytest_mh import KnownTopologyBase, KnownTopologyGroupBase, Topology, TopologyDomain, TopologyMark
from pytest_mh import (
KnownTopologyBase,
KnownTopologyGroupBase,
Topology,
TopologyController,
TopologyDomain,
TopologyMark,
)

__all__ = [
"KnownTopology",
Expand Down Expand Up @@ -45,6 +52,8 @@ def __init__(
self,
name: str,
topology: Topology,
*,
controller: TopologyController | None = None,
fixtures: dict[str, str] | None = None,
domains: dict[str, str] | None = None,
) -> None:
Expand All @@ -53,12 +62,14 @@ def __init__(
:type name: str
:param topology: Topology required to run the test.
:type topology: Topology
:param controller: Topology controller, defaults to None
:type controller: TopologyController | None, optional
:param fixtures: Dynamically created fixtures available during the test run.
:type fixtures: dict[str, str] | None, optional
:param domains: Automatically created SSSD domains on client host
:type domains: dict[str, str] | None, optional
"""
super().__init__(name, topology, fixtures)
super().__init__(name, topology, controller=controller, fixtures=fixtures)

self.domains: dict[str, str] = domains if domains is not None else {}
"""Map hosts to SSSD domains."""
Expand Down Expand Up @@ -115,9 +126,10 @@ def _CreateFromArgs(cls, item: pytest.Function, args: Tuple, kwargs: Mapping[str
name = args[0]
topology = args[1]
domains = args[2] if len(args) == 3 else {}
fixtures = {k: str(v) for k, v in kwargs.items()}
controller = kwargs.get("controller", None)
fixtures = {k: str(v) for k, v in kwargs.get("fixtures", {}).items()}

return cls(name, topology, fixtures, domains)
return cls(name, topology, controller=controller, fixtures=fixtures, domains=domains)


@final
Expand Down
Loading