Skip to content

Commit

Permalink
chore: updates for compatibility with deadline-cloud-test-fixtures
Browse files Browse the repository at this point in the history
Signed-off-by: Jericho Tolentino <68654047+jericht@users.noreply.github.com>
  • Loading branch information
jericht committed Apr 18, 2024
1 parent 5b8692b commit fb049ec
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 131 deletions.
130 changes: 0 additions & 130 deletions test/conftest.py

This file was deleted.

112 changes: 111 additions & 1 deletion test/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

from __future__ import annotations

from unittest.mock import MagicMock, patch
import os
import secrets
import string
from typing import Optional

import pytest
from pytest import FixtureRequest
Expand All @@ -29,6 +31,9 @@
)

from deadline_worker_agent.api_models import HostProperties, IpAddresses
from deadline_worker_agent.installer import (
ParsedCommandLineArguments,
)
from deadline_worker_agent.sessions.job_entities.job_details import (
JobAttachmentSettings,
JobDetails,
Expand All @@ -40,6 +45,111 @@
)
from deadline_worker_agent.startup.config import JobsRunAsUserOverride

VFS_DEFAULT_INSTALL_PATH = "/opt/deadline_vfs"


@pytest.fixture
def region() -> str:
return "us-west-2"


@pytest.fixture
def user() -> str:
return "wa_user"


@pytest.fixture
def password() -> str:
alphabet = string.ascii_letters + string.digits + string.punctuation
return "".join(secrets.choice(alphabet) for _ in range(12))


@pytest.fixture(params=("wa_group",))
def group(request: pytest.FixtureRequest) -> Optional[str]:
return request.param


@pytest.fixture
def service_start() -> bool:
return False


@pytest.fixture
def confirmed() -> bool:
return True


@pytest.fixture
def allow_shutdown() -> bool:
return False


@pytest.fixture
def telemetry_opt_out() -> bool:
return True


@pytest.fixture
def install_service() -> bool:
return True


@pytest.fixture
def vfs_install_path() -> str:
return VFS_DEFAULT_INSTALL_PATH


@pytest.fixture
def grant_required_access() -> bool:
return True


@pytest.fixture
def disallow_instance_profile() -> bool:
return True


@pytest.fixture
def parsed_args(
farm_id: str,
fleet_id: str,
region: str,
user: str,
password: Optional[str],
group: Optional[str],
service_start: bool,
confirmed: bool,
allow_shutdown: bool,
install_service: bool,
telemetry_opt_out: bool,
vfs_install_path: str,
grant_required_access: bool,
disallow_instance_profile: bool,
) -> ParsedCommandLineArguments:
parsed_args = ParsedCommandLineArguments()
parsed_args.farm_id = farm_id
parsed_args.fleet_id = fleet_id
parsed_args.user = user
parsed_args.password = password
parsed_args.group = group
parsed_args.region = region
parsed_args.service_start = service_start
parsed_args.confirmed = confirmed
parsed_args.allow_shutdown = allow_shutdown
parsed_args.install_service = install_service
parsed_args.telemetry_opt_out = telemetry_opt_out
parsed_args.vfs_install_path = vfs_install_path
parsed_args.grant_required_access = grant_required_access
parsed_args.disallow_instance_profile = disallow_instance_profile
return parsed_args


@pytest.fixture(
params=("linux",),
)
def platform(request: pytest.FixtureRequest) -> str:
return request.param


@pytest.fixture
def client() -> MagicMock:
Expand Down

0 comments on commit fb049ec

Please sign in to comment.