aws-deadline / deadline-cloud-test-fixtures

This package contains pytest fixtures that are used to test AWS Deadline Cloud Python packages
Apache License 2.0
9 stars 13 forks source link

refactor!: improve support for ec2 instance workers #143

Closed ddneilson closed 1 month ago

ddneilson commented 1 month ago

What was the problem/requirement? (What/Why)

The PosixInstanceWorker and WindowsInstanceWorker classes implement a CMF Worker based on an ec2 host. In both cases they start with an empty AMI image (AL2023 or Win Server 2022) then set up users, install the agent, etc. Tests that need to use an AMI that already has users and the agent installed end up having to hack around a lot of assumptions in these classes, or reimplement everything for an ec2-based worker from scratch.

What was the solution? (How)

Refactor the PosixInstanceWorker and WindowsInstanceWorker to split them into os-specific base classes that contain all of the generic worker implementation stuff (starting the worker, getting its id, etc), and a derived class that implements the user-setup, agent install, and the like. This makes space for tests that use an AMI with the users & agent pre-setup to derive from the os-specific base classes to get the generic ec2-worker test functionality.

What is the impact of this change?

Downstream consumers no longer need to resort to hacky workarounds to test worker configurations that have the agent & host setup baked into an AMI

How was this change tested?

I've run this with the deadline-cloud-worker-agent e2e tests; the windows & linux e2e tests, and the cross-os tests under each.

I've also run this against internal testing infrastructure that is providing a pre-built AL2023 and WindowsServer2022 AMI to the testing infrastructure.

Everything passes everywhere. The deadline-cloud-worker-agent e2e tests need no modifications to take on these changes.

Was this change documented?

No

Is this a breaking change?

BREAKING CHANGE: PosixInstanceWorker has been renamed to PosixInstanceBuildWorker, and WindowsInstanceWorker has been renamed to WindowsInstanceBuildWorker.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud