Skip to content

Commit

Permalink
Add tests for coriolis.api.v1.minion_pools module
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi1324 committed Dec 6, 2023
1 parent 1cb5ca2 commit c4626b9
Show file tree
Hide file tree
Showing 5 changed files with 477 additions and 0 deletions.
34 changes: 34 additions & 0 deletions coriolis/tests/api/v1/data/minion_pool_numeric_values.yml
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: 1
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: 0
exception_raised: "'minion_max_idle_time' must be a strictly positive "
15 changes: 15 additions & 0 deletions coriolis/tests/api/v1/data/minion_pool_retention_strategy.yml
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 coriolis/tests/api/v1/data/minion_validate_create_body.yml
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 "
61 changes: 61 additions & 0 deletions coriolis/tests/api/v1/data/minion_validate_update_body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
- config:
body:
minion_pool: {}
exception_raised: False

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
exception_raised: False

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
minion_retention_strategy: "mock_minion_retention_strategy"
validate_minion_retention_strategy: True
exception_raised: False

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
endpoint_id: "mock_endpoint_id"
exception_raised: "The 'endpoint_id' of a minion pool cannot be updated."

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
platform: "mock_platform"
exception_raised: "The 'platform' of a minion pool cannot be updated."

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
minimum_minions: 2
maximum_minions: 2
minion_max_idle_time: 2
validate_get_minion_pool: True
exception_raised: False

- config:
body:
minion_pool:
name: "mock_name"
notes: "mock_notes"
os_type: "mock_os_type"
environment_options: "mock_environment_options"
exception_raised: False
Loading

0 comments on commit c4626b9

Please sign in to comment.