diff options
| author | Scott Moser <smoser@brickies.net> | 2017-12-05 17:05:29 -0500 |
|---|---|---|
| committer | Scott Moser <smoser@brickies.net> | 2017-12-05 17:05:29 -0500 |
| commit | 47016791ca5e97d80e45d3f100bc4e5d0b88627d (patch) | |
| tree | 70f9e5bad3b136abeecd6399b077c82a81953220 /tests/cloud_tests/platforms/__init__.py | |
| parent | 7acc9e68fafbbd7c56587aebe752ba6ba8c8a3db (diff) | |
| download | vyos-cloud-init-47016791ca5e97d80e45d3f100bc4e5d0b88627d.tar.gz vyos-cloud-init-47016791ca5e97d80e45d3f100bc4e5d0b88627d.zip | |
tests: consolidate platforms into specific dirs
This groups up each test platform into its own directory rather
than having files spread between four different directories for
one platform. Platforms tend to be worked on one at a time and
so having the platforms together makes more sense than apart.
Diffstat (limited to 'tests/cloud_tests/platforms/__init__.py')
| -rw-r--r-- | tests/cloud_tests/platforms/__init__.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/cloud_tests/platforms/__init__.py b/tests/cloud_tests/platforms/__init__.py index 3490fe87..92ed1627 100644 --- a/tests/cloud_tests/platforms/__init__.py +++ b/tests/cloud_tests/platforms/__init__.py @@ -2,8 +2,8 @@ """Main init.""" -from tests.cloud_tests.platforms import lxd -from tests.cloud_tests.platforms import nocloudkvm +from .lxd import platform as lxd +from .nocloudkvm import platform as nocloudkvm PLATFORMS = { 'nocloud-kvm': nocloudkvm.NoCloudKVMPlatform, @@ -11,6 +11,16 @@ PLATFORMS = { } +def get_image(platform, config): + """Get image from platform object using os_name.""" + return platform.get_image(config) + + +def get_instance(snapshot, *args, **kwargs): + """Get instance from snapshot.""" + return snapshot.launch(*args, **kwargs) + + def get_platform(platform_name, config): """Get the platform object for 'platform_name' and init.""" platform_cls = PLATFORMS.get(platform_name) @@ -18,4 +28,10 @@ def get_platform(platform_name, config): raise ValueError('invalid platform name: {}'.format(platform_name)) return platform_cls(config) + +def get_snapshot(image): + """Get snapshot from image.""" + return image.snapshot() + + # vi: ts=4 expandtab |
