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 16, 2025
1 parent f93d032 commit 2db4b14
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,15 @@ async def simple_hostprovider_bundle(adcm_client: ADCMClient, tmp_path: Path) ->
async def complex_hostprovider_bundle(adcm_client: ADCMClient, tmp_path: Path) -> Bundle:
bundle_path = pack_bundle(from_dir=BUNDLES / "complex_provider", to=tmp_path)
return await adcm_client.bundles.create(source=bundle_path, accept_license=True)


@pytest_asyncio.fixture()
def adcm_for_examples(
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
Empty file.
23 changes: 23 additions & 0 deletions tests/integration/examples/test_iteration_with_cluster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest

from adcm_aio_client import ADCMSession, Credentials
from tests.integration.setup_environment import ADCMContainer

pytestmark = [pytest.mark.asyncio]


async def test_iteration_with_cluster(adcm_for_examples: 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.
"""
credentials = Credentials(username="admin", password="admin") # noqa: S106
url = adcm_for_examples.url
kwargs: dict = {
"timeout": 10,
"retry_interval": 1,
"retry_attempts": 1,
}
async with ADCMSession(url=url, credentials=credentials, **kwargs) as client:
clusters = await client.clusters.all()
assert len(clusters) == 0

0 comments on commit 2db4b14

Please sign in to comment.