Skip to content

Commit

Permalink
fix: apply CreateQueue API changes (aws-deadline#49)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Usiskin <[email protected]>
  • Loading branch information
jusiskin authored Jan 12, 2024
1 parent 53469fa commit f3b3dc7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/deadline_test_fixtures/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class BootstrapResources:
job_attachments_root_prefix: InitVar[str | None] = None

job_run_as_user: JobRunAsUser = field(
default_factory=lambda: JobRunAsUser(PosixSessionUser("", ""))
default_factory=lambda: JobRunAsUser(
posix=PosixSessionUser("", ""), runAs="WORKER_AGENT_USER"
)
)

def __post_init__(
Expand Down
8 changes: 6 additions & 2 deletions src/deadline_test_fixtures/job_attachment_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ def deploy_resources(self):
client=self.deadline_client,
display_name="job_attachments_test_queue",
farm=self.farm,
job_run_as_user=JobRunAsUser(PosixSessionUser("", "")),
job_run_as_user=JobRunAsUser(
posix=PosixSessionUser("", ""), runAs="WORKER_AGENT_USER"
),
)
self.queue_with_no_settings = Queue.create(
client=self.deadline_client,
display_name="job_attachments_test_no_settings_queue",
farm=self.farm,
job_run_as_user=JobRunAsUser(PosixSessionUser("", "")),
job_run_as_user=JobRunAsUser(
posix=PosixSessionUser("", ""), runAs="WORKER_AGENT_USER"
),
)
self.stack.deploy(cfn_client=self.cfn_client)
except (ClientError, WaiterError):
Expand Down
3 changes: 2 additions & 1 deletion src/deadline_test_fixtures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from typing import Generator
from typing import Generator, Literal


@dataclass(frozen=True)
Expand All @@ -34,6 +34,7 @@ class PosixSessionUser:
@dataclass(frozen=True)
class JobRunAsUser:
posix: PosixSessionUser
runAs: Literal["QUEUE_CONFIGURED_USER", "WORKER_AGENT_USER"]


@dataclass(frozen=True)
Expand Down
5 changes: 4 additions & 1 deletion test/unit/deadline/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def test_create(self, farm: Farm) -> None:
job_attachments = JobAttachmentSettings(bucket_name="bucket", root_prefix="root")
mock_client = MagicMock()
mock_client.create_queue.return_value = {"queueId": queue_id}
job_run_as_user = JobRunAsUser(posix=PosixSessionUser(user="test-user", group="test-group"))
job_run_as_user = JobRunAsUser(
posix=PosixSessionUser(user="test-user", group="test-group"),
runAs="QUEUE_CONFIGURED_USER",
)

# WHEN
result = Queue.create(
Expand Down

0 comments on commit f3b3dc7

Please sign in to comment.