Skip to content

Commit

Permalink
ADCM-6280: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBalalan committed Jan 21, 2025
1 parent 147709b commit e5e8f3b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/integration/examples/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@


async def test_service(example_cluster: Cluster, three_hosts: list[Host]) -> None:
"""
Service (`cluster.services`) API Examples:
- adding a service to cluster
- with accepting license
- with dependencies
- retrieval with filtering / all cluster's services
- iteration through all cluster's services
- service removal
- turning on maintenance mode
- refreshing service's data
Component (`service.components`) API Examples:
- retrieval with filtering / all service's components
- retrieval hosts, mapped to component with filtering / all mapped hosts
- turning on maintenance mode
- refreshing component's data
"""
cluster = example_cluster
host_1, host_2, host_3 = sorted(three_hosts, key=lambda host: host.name)

Expand Down Expand Up @@ -64,6 +80,13 @@ async def test_service(example_cluster: Cluster, three_hosts: list[Host]) -> Non
# Get all component's hosts
component_hosts: list[Host] = await component.hosts.all() # noqa: F841

# Iterate through all service's components
async for comp in service.components.iter(): # noqa: B007
pass

# Get all hosts, mapped to component
all_component_hosts: list[Host] = await component.hosts.all() # noqa: F841

# Get specific host, mapped to this component
host_2_from_component = await component.hosts.get(name__eq=host_2.name) # noqa: F841

Expand Down

0 comments on commit e5e8f3b

Please sign in to comment.