-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1209a56
commit 619b3ff
Showing
22 changed files
with
2,116 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
- config: | ||
migration: | ||
user_scripts: | ||
mock_user_scripts: null | ||
instances: ["mock_instance1", "mock_instance2"] | ||
replica_id: 'mock_replica_id' | ||
clone_disks: True | ||
force: False | ||
skip_os_morphing: False | ||
instance_osmorphing_minion_pool_mappings: | ||
mock_mapping: "mock_value" | ||
expected_api_method: "deploy_replica_instances" | ||
validation_expected: False | ||
|
||
- config: | ||
migration: | ||
user_scripts: | ||
mock_user_scripts: null | ||
instances: ["mock_instance1", "mock_instance2"] | ||
replica_id: null | ||
clone_disks: True | ||
force: False | ||
skip_os_morphing: False | ||
instance_osmorphing_minion_pool_mappings: | ||
mock_mapping: "mock_value" | ||
expected_api_method: "migrate_instances" | ||
validation_expected: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- NotFound | ||
- InvalidParameterValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
- config: | ||
{} | ||
exception_raised: False | ||
|
||
- config: | ||
minimum_minions: 1 | ||
maximum_minions: 1 | ||
minion_max_idle_time: 0 | ||
exception_raised: False | ||
|
||
- config: | ||
minimum_minions: 0 | ||
exception_raised: "'minimum_minions' must be a strictly positive integer. " | ||
|
||
- config: | ||
minimum_minions: 1 | ||
maximum_minions: 0 | ||
exception_raised: "'maximum_minions' must be a strictly positive integer. " | ||
|
||
- config: | ||
minimum_minions: 1 | ||
maximum_minions: 1 | ||
exception_raised: False | ||
|
||
- config: | ||
minimum_minions: 2 | ||
maximum_minions: 1 | ||
exception_raised: "'maximum_minions' value .* must be at least as large as" | ||
|
||
- config: | ||
minimum_minions: 1 | ||
maximum_minions: 1 | ||
minion_max_idle_time: -1 | ||
exception_raised: "'minion_max_idle_time' must be a strictly positive " |
15 changes: 15 additions & 0 deletions
15
coriolis/tests/api/v1/data/minion_pool_retention_strategy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- config: | ||
exception_raised: True | ||
pool_retention_strategy: null | ||
|
||
- config: | ||
exception_raised: False | ||
pool_retention_strategy: 'MINION_POOL_MACHINE_RETENTION_STRATEGY_DELETE' | ||
|
||
- config: | ||
exception_raised: False | ||
pool_retention_strategy: 'MINION_POOL_MACHINE_RETENTION_STRATEGY_POWEROFF' | ||
|
||
- config: | ||
exception_raised: True | ||
pool_retention_strategy: 'invalid' |
65 changes: 65 additions & 0 deletions
65
coriolis/tests/api/v1/data/minion_validate_create_body.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
- config: | ||
body: | ||
minion_pool: | ||
name: "mock_name" | ||
endpoint_id: "mock_endpoint_id" | ||
os_type: "OS_TYPE_LINUX" | ||
platform: "PROVIDER_PLATFORM_SOURCE" | ||
environment_options: "mock_environment_options" | ||
notes: "mock_notes" | ||
minion_retention_strategy: "" | ||
expected_validation_api_method: "validate_endpoint_source_minion_pool_options" | ||
exception_raised: False | ||
|
||
- config: | ||
body: | ||
minion_pool: | ||
name: "mock_name" | ||
endpoint_id: "mock_endpoint_id" | ||
os_type: "OS_TYPE_LINUX" | ||
platform: "PROVIDER_PLATFORM_DESTINATION" | ||
environment_options: "mock_environment_options" | ||
notes: "mock_notes" | ||
minion_retention_strategy: "" | ||
expected_validation_api_method: "validate_endpoint_destination_minion_pool_options" | ||
exception_raised: False | ||
|
||
- config: | ||
body: | ||
minion_pool: | ||
name: "mock_name" | ||
endpoint_id: "mock_endpoint_id" | ||
os_type: "invalid" | ||
platform: "PROVIDER_PLATFORM_SOURCE" | ||
environment_options: "mock_environment_options" | ||
notes: "mock_notes" | ||
minion_retention_strategy: "" | ||
expected_validation_api_method: "validate_endpoint_source_minion_pool_options" | ||
exception_raised: "The provided pool OS type .* is invalid." | ||
|
||
- config: | ||
body: | ||
minion_pool: | ||
name: "mock_name" | ||
endpoint_id: "mock_endpoint_id" | ||
os_type: "OS_TYPE_LINUX" | ||
platform: "invalid" | ||
environment_options: "mock_environment_options" | ||
notes: "mock_notes" | ||
minion_retention_strategy: "" | ||
expected_validation_api_method: "validate_endpoint_source_minion_pool_options" | ||
exception_raised: "The provided pool platform .* is invalid." | ||
|
||
- config: | ||
body: | ||
minion_pool: | ||
name: "mock_name" | ||
endpoint_id: "mock_endpoint_id" | ||
os_type: "OS_TYPE_WINDOWS" | ||
platform: "PROVIDER_PLATFORM_SOURCE" | ||
environment_options: "mock_environment_options" | ||
notes: "mock_notes" | ||
minion_retention_strategy: "" | ||
expected_validation_api_method: "validate_endpoint_source_minion_pool_options" | ||
exception_raised: "Source Minion Pools are required to be of OS type " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
- config: | ||
migration: | ||
origin_endpoint_id: "mock_origin_endpoint_id" | ||
destination_endpoint_id: "mock_destination_endpoint_id" | ||
origin_minion_pool_id: "mock_origin_minion_pool_id" | ||
destination_minion_pool_id: "mock_destination_minion_pool_id" | ||
instance_osmorphing_minion_pool_mappings: | ||
mock_instance_1: "mock_pool" | ||
mock_instance_2: "mock_pool" | ||
instances: ['mock_instance_1', 'mock_instance_2'] | ||
notes: "mock_notes" | ||
skip_os_morphing: false | ||
shutdown_instances: false | ||
replication_count: 2 | ||
source_environment: {} | ||
network_map: {} | ||
destination_environment: | ||
network_map: {} | ||
storage_mappings: {} | ||
storage_mappings: {} | ||
raises_value_error: false | ||
|
||
- config: | ||
migration: | ||
origin_endpoint_id: "mock_origin_endpoint_id" | ||
destination_endpoint_id: "mock_destination_endpoint_id" | ||
origin_minion_pool_id: "mock_origin_minion_pool_id" | ||
destination_minion_pool_id: "mock_destination_minion_pool_id" | ||
instance_osmorphing_minion_pool_mappings: | ||
mock_instance_1: "mock_pool" | ||
mock_instance_2: "mock_pool" | ||
instances: ['mock_instance_1', 'mock_instance_3'] | ||
raises_value_error: true | ||
|
||
|
||
- config: | ||
migration: | ||
origin_endpoint_id: "mock_origin_endpoint_id" | ||
destination_endpoint_id: "mock_destination_endpoint_id" | ||
origin_minion_pool_id: "mock_origin_minion_pool_id" | ||
destination_minion_pool_id: "mock_destination_minion_pool_id" | ||
instance_osmorphing_minion_pool_mappings: | ||
mock_instance_1: "mock_pool" | ||
mock_instance_2: "mock_pool" | ||
instances: ['mock_instance_1', 'mock_instance_2'] | ||
replication_count: 13 | ||
raises_value_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2023 Cloudbase Solutions Srl | ||
# All Rights Reserved. | ||
|
||
from unittest import mock | ||
|
||
from coriolis.api.v1 import diagnostics as diag | ||
from coriolis.api.v1.views import diagnostic_view | ||
from coriolis.diagnostics import api | ||
from coriolis.tests import test_base | ||
|
||
|
||
class DiagnosticsControllerTestCase(test_base.CoriolisBaseTestCase): | ||
"""Test suite for the Coriolis Diagnostics v1 API""" | ||
|
||
def setUp(self): | ||
super(DiagnosticsControllerTestCase, self).setUp() | ||
self.diag_api = diag.DiagnosticsController() | ||
|
||
@mock.patch.object(api.API, 'get') | ||
@mock.patch.object(diagnostic_view, 'collection') | ||
def test_index( | ||
self, | ||
mock_collection, | ||
mock_get | ||
): | ||
mock_req = mock.Mock() | ||
mock_context = mock.Mock() | ||
mock_req.environ = {'coriolis.context': mock_context} | ||
|
||
result = self.diag_api.index(mock_req) | ||
|
||
mock_context.can.assert_called_once_with("migration:diagnostics:get") | ||
mock_get.assert_called_once_with(mock_context) | ||
mock_collection.assert_called_once_with(mock_get.return_value) | ||
self.assertEqual(result, mock_collection.return_value) |
Oops, something went wrong.