Skip to content

Commit

Permalink
ADCM-6278 Added a sample implementation of the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
a-alferov committed Jan 17, 2025
1 parent f93d032 commit e8ac845
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Empty file.
22 changes: 22 additions & 0 deletions tests/integration/examples/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from collections.abc import Generator

import pytest_asyncio

from adcm_aio_client.objects import Bundle
from tests.integration.setup_environment import ADCMContainer

TIMEOUT = 10
RETRY_INTERVAL = 1
RETRY_ATTEMPTS = 1


@pytest_asyncio.fixture()
def adcm(
adcm: ADCMContainer,
simple_cluster_bundle: Bundle,
complex_cluster_bundle: Bundle,
previous_complex_cluster_bundle: Bundle,
simple_hostprovider_bundle: Bundle,
) -> Generator[ADCMContainer, None, None]:
_ = simple_cluster_bundle, complex_cluster_bundle, previous_complex_cluster_bundle, simple_hostprovider_bundle
yield adcm
22 changes: 22 additions & 0 deletions tests/integration/examples/test_iteration_with_cluster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest

from adcm_aio_client import ADCMSession, Credentials
from tests.integration.examples.conftest import RETRY_ATTEMPTS, RETRY_INTERVAL, TIMEOUT
from tests.integration.setup_environment import ADCMContainer

pytestmark = [pytest.mark.asyncio]


async def test_iteration_with_cluster(adcm: ADCMContainer) -> None:
"""
Interaction with clusters: creating, deleting, getting a list of clusters using filtering,
configuring cluster configuration, launching actions on the cluster and updating the cluster.
"""
url = adcm.url
credentials = Credentials(username="admin", password="admin") # noqa: S106

async with ADCMSession(
url=url, credentials=credentials, timeout=TIMEOUT, retry_attempts=RETRY_ATTEMPTS, retry_interval=RETRY_INTERVAL
) as client:
clusters = await client.clusters.all()
assert len(clusters) == 0

0 comments on commit e8ac845

Please sign in to comment.