Skip to content

Commit

Permalink
Add tests for coriolis.api.v1.replicas module
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi1324 committed Jan 11, 2024
1 parent 4dd78a1 commit 04193c3
Show file tree
Hide file tree
Showing 6 changed files with 891 additions and 0 deletions.
94 changes: 94 additions & 0 deletions coriolis/tests/api/v1/data/replicas_get_merged_replica_values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

- config:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"
destination_endpoint_id: "mock_destination_endpoint_id"
source_environment: {'mock_source_key': 'mock_source_value'}
destination_environment:
storage_mappings: {'mock_destination_key': 'mock_destination_value'}
network_map: {'mock_network_key': 'mock_network_value'}
user_scripts: {'mock_scripts_key': 'mock_scripts_value'}
notes: "mock_notes"
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_1"
mock_instance_2: "mock_pool_2"
updated_values:
source_environment: {'mock_updated_source_key': 'mock_updated_source_value'}
destination_environment:
storage_mappings: {'mock_updated_destination_key': 'mock_updated_destination_value'}
network_map: {'mock_updated_network_key': 'mock_updated_network_value'}
user_scripts: {'mock_updated_scripts_key': 'mock_updated_scripts_value'}
notes: "mock_updated_notes"
origin_minion_pool_id: "mock_updated_origin_minion_pool_id"
destination_minion_pool_id: "mock_updated_destination_minion_pool_id"
instance_osmorphing_minion_pool_mappings:
mock_instance_1: "mock_updated_pool_1"
mock_instance_2: "mock_updated_pool_2"
expected_result:
source_environment:
mock_updated_source_key: 'mock_updated_source_value'
mock_source_key: 'mock_source_value'
destination_environment:
network_map:
mock_updated_network_key: 'mock_updated_network_value'
mock_network_key: 'mock_network_value'
storage_mappings:
mock_updated_destination_key: 'mock_updated_destination_value'
network_map:
mock_updated_network_key: 'mock_updated_network_value'
mock_network_key: 'mock_network_value'
notes: "mock_updated_notes"
origin_minion_pool_id: "mock_updated_origin_minion_pool_id"
destination_minion_pool_id: "mock_updated_destination_minion_pool_id"
instance_osmorphing_minion_pool_mappings:
mock_instance_1: "mock_updated_pool_1"
mock_instance_2: "mock_updated_pool_2"

- config:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"
destination_endpoint_id: "mock_destination_endpoint_id"
source_environment: {'mock_source_key': 'mock_source_value'}
destination_environment:
storage_mappings: {'mock_destination_key': 'mock_destination_value'}
network_map: {'mock_network_key': 'mock_network_value'}
user_scripts: {'mock_scripts_key': 'mock_scripts_value'}
notes: "mock_notes"
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_1"
mock_instance_2: "mock_pool_2"
updated_values: {}
expected_result:
source_environment:
mock_source_key: 'mock_source_value'
destination_environment:
network_map:
mock_network_key: 'mock_network_value'
storage_mappings:
mock_destination_key: 'mock_destination_value'
network_map:
mock_network_key: 'mock_network_value'
notes: "mock_notes"

- config:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"
destination_endpoint_id: "mock_destination_endpoint_id"
user_scripts: {'mock_scripts_key': 'mock_scripts_value'}
notes: "mock_notes"
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_1"
mock_instance_2: "mock_pool_2"
updated_values: {}
expected_result:
source_environment: {}
destination_environment: {}
network_map: {}
notes: "mock_notes"

156 changes: 156 additions & 0 deletions coriolis/tests/api/v1/data/replicas_update_storage_mappings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@

- config:
original_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
new_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_3
disk_mappings:
- disk_id: "disk_1"
destination: destination_4
logs_expected: True
expected_result:
backend_mappings:
- source: "source_2"
destination: destination_2
- source: "source_1"
destination: destination_3
disk_mappings:
- disk_id: "disk_2"
destination: destination_2
- disk_id: "disk_1"
destination: destination_4

- config:
original_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
new_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_3
logs_expected: True
expected_result:
backend_mappings:
- source: "source_2"
destination: destination_2
- source: "source_1"
destination: destination_3
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2

- config:
original_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
new_storage_mappings:
disk_mappings:
- disk_id: "disk_1"
destination: destination_3
logs_expected: True
expected_result:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_2"
destination: destination_2
- disk_id: "disk_1"
destination: destination_3

- config:
original_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
new_storage_mappings: {}
logs_expected: False
expected_result:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2

- config:
original_storage_mappings:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
default: "mock_default_1"
new_storage_mappings:
backend_mappings:
- source: "source_3"
destination: destination_3
disk_mappings:
- disk_id: "disk_3"
destination: destination_3
default: "mock_default_2"
logs_expected: False
expected_result:
backend_mappings:
- source: "source_1"
destination: destination_1
- source: "source_2"
destination: destination_2
- source: "source_3"
destination: destination_3
disk_mappings:
- disk_id: "disk_1"
destination: destination_1
- disk_id: "disk_2"
destination: destination_2
- disk_id: "disk_3"
destination: destination_3
default: "mock_default_2"

56 changes: 56 additions & 0 deletions coriolis/tests/api/v1/data/replicas_validate_create_body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

- config:
body:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"
destination_endpoint_id: "mock_destination_endpoint_id"
source_environment: "mock_source_environment"
destination_environment:
network_map: "mock_network_map"
instances: ['mock_instance_1', 'mock_instance_2']
notes: "mock_notes"
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"
network_map: "mock_network_map"
user_scripts: "mock_user_scripts"
storage_mappings: "mock_storage_mappings"
exception_raised: False
expected_result:
- mock_origin_endpoint_id
- mock_destination_endpoint_id
- mock_source_environment
- {'network_map': 'mock_network_map',
'storage_mappings': 'mock_storage_mappings'}
- ['mock_instance_1', 'mock_instance_2']
- mock_network_map
- mock_storage_mappings
- mock_notes
- mock_origin_minion_pool_id
- mock_destination_minion_pool_id
- {'mock_instance_1': 'mock_pool', 'mock_instance_2': 'mock_pool'}
- mock_user_scripts

- config:
body:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"
destination_endpoint_id: "mock_destination_endpoint_id"
source_environment: "mock_source_environment"
destination_environment:
network_map: "mock_network_map"
instances: ['mock_instance_1', 'mock_instance_2']
notes: "mock_notes"
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_3: "mock_pool"
network_map: "mock_network_map"
user_scripts: "mock_user_scripts"
storage_mappings: "mock_storage_mappings"
exception_raised: "One or more instance OSMorphing pool mappings were"
expected_result:

31 changes: 31 additions & 0 deletions coriolis/tests/api/v1/data/replicas_validate_update_body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

- config:
body:
replica:
source_environment: "mock_source_environment"
destination_environment: "mock_destination_environment"
storage_mappings: {'mock_updated_destination_key': 'mock_updated_destination_value'}
network_map: {'mock_updated_network_key': 'mock_updated_network_value'}
user_scripts: {'mock_updated_scripts_key': 'mock_updated_scripts_value'}
notes: "mock_updated_notes"
origin_minion_pool_id: "mock_updated_origin_minion_pool_id"
destination_minion_pool_id: "mock_updated_destination_minion_pool_id"
instance_osmorphing_minion_pool_mappings:
mock_instance_1: "mock_updated_pool_1"
mock_instance_2: "mock_updated_pool_2"
replica:
destination_endpoint_id: "mock_destination_endpoint_id"
origin_endpoint_id: "mock_origin_endpoint_id"
instances: "mock_instances"
expected_result:
source_environment: "mock_source_environment"
destination_environment: "mock_destination_environment"
storage_mappings: {'mock_updated_destination_key': 'mock_updated_destination_value'}
network_map: {'mock_updated_network_key': 'mock_updated_network_value'}
user_scripts: {'mock_updated_scripts_key': 'mock_updated_scripts_value'}
notes: "mock_updated_notes"
origin_minion_pool_id: "mock_updated_origin_minion_pool_id"
destination_minion_pool_id: "mock_updated_destination_minion_pool_id"
instance_osmorphing_minion_pool_mappings:
mock_instance_1: "mock_updated_pool_1"
mock_instance_2: "mock_updated_pool_2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

- body:
replica:
origin_endpoint_id: "mock_origin_endpoint_id"

- body:
replica:
destination_endpoint_id: "mock_destination_endpoint_id"

- body:
replica:
instances: "instances"

Loading

0 comments on commit 04193c3

Please sign in to comment.