-
Notifications
You must be signed in to change notification settings - Fork 67
integration: Adds OS morphing deployment integration test #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright 2026 Cloudbase Solutions Srl | ||
| # All Rights Reserved. | ||
|
|
||
| """Integration tests for the OS morphing deployments. | ||
|
|
||
| Exercises deployments with skip_os_morphing=False, OS detection, and package | ||
| installation in the target OS. | ||
| """ | ||
|
|
||
| from coriolis.tests.integration import base as integration_base | ||
| from coriolis.tests.integration import utils as test_utils | ||
|
|
||
|
|
||
| class OsMorphingDeploymentTest(integration_base.ReplicaIntegrationTestBase): | ||
|
|
||
| # NOTE(claudiub): Size must be high enough to contain the tested OS and | ||
| # any new packages to be added during OS morphing. | ||
| _SCSI_DEBUG_SIZE_MB = 256 | ||
|
|
||
| def setUp(self): | ||
| super().setUp() | ||
| test_utils.write_os_image_to_disk(self._src_device, "ubuntu:24.04") | ||
|
|
||
| def test_deployment_with_os_morphing(self): | ||
| self.assertFalse( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels a bit brittle. So if On the other hand, we can keep it for the sake of simplicity. We'll use a different package if that happens :).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. In this example, we're basically using a container image, which is supposed to be a minimal base image to be further used for for other purposes; it shouldn't have a situational package as I've added this assertion as a sanity check, so we don't have a potentially false positive test (expect package to be installed by OS morphing, but it already existed anyways). I'd keep |
||
| test_utils.path_exists_on_device(self._src_device, "usr/bin/jq"), | ||
| "jq was found on the source device before OS morphing", | ||
| ) | ||
|
|
||
| self._execute_and_wait(self._transfer.id) | ||
|
|
||
| deployment = self._client.deployments.create_from_transfer( | ||
| self._transfer.id, | ||
| skip_os_morphing=False, | ||
| ) | ||
| self.addCleanup(self._client.deployments.delete, deployment.id) | ||
|
|
||
| self.assertDeploymentCompleted(deployment.id) | ||
| self.assertTrue( | ||
| test_utils.path_exists_on_device(self._dst_device, "usr/bin/jq"), | ||
| "jq was not found on the destination device after OS morphing", | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright 2026 Cloudbase Solutions Srl | ||
| # All Rights Reserved. | ||
|
|
||
| from coriolis.osmorphing import base | ||
| from coriolis.tests.integration.test_provider.osmorphing import ubuntu | ||
|
|
||
|
|
||
| OS_MORPHERS: list[base.BaseLinuxOSMorphingTools] = [ | ||
| ubuntu.TestUbuntuOSMorphingTools, | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright 2026 Cloudbase Solutions Srl | ||
| # All Rights Reserved. | ||
|
|
||
| """ | ||
| Ubuntu OS Morphing tools. | ||
| """ | ||
|
|
||
| from coriolis.osmorphing import ubuntu | ||
|
|
||
|
|
||
| class TestUbuntuOSMorphingTools(ubuntu.BaseUbuntuMorphingTools): | ||
| """Ubuntu OSMorphing tools for integration tests.""" | ||
|
|
||
| # Package meant to be installed during OS morphing. | ||
| # jq is a very small package which is not available by default. | ||
| _packages = { | ||
| None: [("jq", True)], | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we planning to switch to loopback devices btw? I think we'll need to in order to parallelize the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid we'll be using those for now. loopback devices are fine on the importer (
coriolis-writerdoesn't care what type of device it writes to), but on the exporter,coriolis-replicatorignores loopback devices.