fog-azure-rm-temp 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.arclint +8 -0
- data/.travis.yml +28 -14
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTORS.md +4 -0
- data/fog-azure-rm.gemspec +3 -2
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/async_response.rb +9 -1
- data/lib/fog/azurerm/compute.rb +3 -1
- data/lib/fog/azurerm/constants.rb +11 -3
- data/lib/fog/azurerm/dns.rb +3 -1
- data/lib/fog/azurerm/docs/application_gateway.md +119 -117
- data/lib/fog/azurerm/docs/compute.md +299 -202
- data/lib/fog/azurerm/docs/dns.md +44 -43
- data/lib/fog/azurerm/docs/key_vault.md +31 -28
- data/lib/fog/azurerm/docs/network.md +407 -404
- data/lib/fog/azurerm/docs/resources.md +52 -49
- data/lib/fog/azurerm/docs/sql.md +56 -54
- data/lib/fog/azurerm/docs/storage.md +92 -157
- data/lib/fog/azurerm/docs/traffic_manager.md +55 -53
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +5 -1
- data/lib/fog/azurerm/models/compute/availability_set.rb +4 -1
- data/lib/fog/azurerm/models/compute/managed_disk.rb +0 -1
- data/lib/fog/azurerm/models/compute/server.rb +61 -11
- data/lib/fog/azurerm/models/compute/servers.rb +2 -2
- data/lib/fog/azurerm/models/dns/a_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/cname_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/record_set.rb +20 -8
- data/lib/fog/azurerm/models/key_vault/vault.rb +3 -1
- data/lib/fog/azurerm/models/network/load_balancer.rb +3 -1
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +3 -1
- data/lib/fog/azurerm/models/network/network_interface.rb +3 -1
- data/lib/fog/azurerm/models/network/network_security_group.rb +4 -2
- data/lib/fog/azurerm/models/network/public_ip.rb +4 -2
- data/lib/fog/azurerm/models/network/virtual_network.rb +4 -2
- data/lib/fog/azurerm/models/resources/resource_group.rb +3 -1
- data/lib/fog/azurerm/models/sql/sql_database.rb +3 -3
- data/lib/fog/azurerm/models/sql/sql_server.rb +3 -2
- data/lib/fog/azurerm/models/storage/directories.rb +6 -1
- data/lib/fog/azurerm/models/storage/file.rb +2 -0
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -1
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +7 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +3 -1
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +1 -1
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +1 -0
- data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +2 -2
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +2 -2
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +4 -2
- data/lib/fog/azurerm/requests/compute/create_image.rb +68 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +302 -135
- data/lib/fog/azurerm/requests/compute/delete_image.rb +29 -0
- data/lib/fog/azurerm/requests/compute/get_image.rb +45 -0
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/dns/check_zone_exists.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_record_set.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_zone.rb +1 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +1 -1
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +1 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_public_ip_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_virtual_network_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +1 -2
- data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_public_ip.rb +5 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +1 -1
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +4 -4
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +2 -1
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +4 -4
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +4 -4
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +13 -10
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +8 -5
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +4 -2
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb +13 -3
- data/lib/fog/azurerm/storage.rb +0 -18
- data/lib/fog/azurerm/utilities/general.rb +21 -10
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +7 -1
- data/rakefile +1 -1
- data/test/api_stub.rb +19 -2
- data/test/api_stub/models/compute/server.rb +21 -5
- data/test/api_stub/requests/compute/image.rb +41 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +60 -62
- data/test/api_stub/requests/resources/resource_group.rb +1 -1
- data/test/integration/application_gateway.rb +8 -1
- data/test/integration/availability_set.rb +9 -2
- data/test/integration/external_load_balancer.rb +2 -1
- data/test/integration/internal_load_balancer.rb +2 -1
- data/test/integration/key_vault.rb +2 -1
- data/test/integration/managed_disk.rb +10 -5
- data/test/integration/network_interface.rb +2 -1
- data/test/integration/network_security_group.rb +2 -1
- data/test/integration/public_ip.rb +2 -1
- data/test/integration/record_set.rb +5 -5
- data/test/integration/resource_group.rb +5 -2
- data/test/integration/resource_tag.rb +4 -2
- data/test/integration/server.rb +113 -23
- data/test/integration/server_custom_image.rb +120 -20
- data/test/integration/sql_server.rb +10 -2
- data/test/integration/storage_account.rb +32 -20
- data/test/integration/traffic_manager.rb +6 -1
- data/test/integration/virtual_network.rb +2 -1
- data/test/integration/virtual_network_gateway_connection.rb +3 -3
- data/test/models/application_gateway/test_gateway.rb +2 -1
- data/test/models/compute/test_availability_set.rb +2 -1
- data/test/models/compute/test_managed_disk.rb +2 -1
- data/test/models/compute/test_server.rb +13 -4
- data/test/models/dns/test_zone.rb +2 -1
- data/test/models/key_vault/test_vault.rb +2 -1
- data/test/models/network/test_load_balancer.rb +2 -1
- data/test/models/network/test_network_interface.rb +2 -1
- data/test/models/network/test_network_security_group.rb +2 -1
- data/test/models/network/test_public_ip.rb +2 -1
- data/test/models/network/test_virtual_network.rb +2 -1
- data/test/models/resources/test_resource_group.rb +2 -1
- data/test/models/sql/test_database.rb +2 -1
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/storage/test_storage_account.rb +2 -1
- data/test/models/traffic_manager/test_traffic_manager_profile.rb +2 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +11 -4
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +2 -2
- data/test/requests/compute/test_check_availability_set_exists.rb +9 -2
- data/test/requests/compute/test_check_managed_disk_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_extension_exists.rb +9 -2
- data/test/requests/compute/test_create_image.rb +27 -0
- data/test/requests/compute/test_create_virtual_machine.rb +41 -17
- data/test/requests/compute/test_delete_image.rb +23 -0
- data/test/requests/compute/test_get_image.rb +23 -0
- data/test/requests/dns/test_check_record_set_exists.rb +9 -2
- data/test/requests/dns/test_check_zone_exists.rb +16 -2
- data/test/requests/key_vault/test_check_vault_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_circuit_exists.rb +9 -2
- data/test/requests/network/test_check_load_balancer_exists.rb +9 -2
- data/test/requests/network/test_check_local_net_gateway_exists.rb +11 -4
- data/test/requests/network/test_check_net_sec_group_exists.rb +9 -2
- data/test/requests/network/test_check_net_sec_rule_exists.rb +9 -2
- data/test/requests/network/test_check_network_interface_exists.rb +9 -2
- data/test/requests/network/test_check_public_ip_exists.rb +9 -2
- data/test/requests/network/test_check_subnet_exists.rb +9 -2
- data/test/requests/network/test_check_virtual_network_exists.rb +10 -4
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +9 -2
- data/test/requests/network/test_check_vnet_gateway_exists.rb +9 -2
- data/test/requests/network/test_create_load_balancer.rb +3 -2
- data/test/requests/network/test_create_network_interface.rb +4 -3
- data/test/requests/network/test_create_or_update_network_security_group.rb +3 -2
- data/test/requests/network/test_create_or_update_virtual_network.rb +5 -3
- data/test/requests/network/test_create_public_ip.rb +3 -2
- data/test/requests/network/test_update_public_ip.rb +3 -2
- data/test/requests/resources/test_create_resource_group.rb +3 -2
- data/test/requests/resources/test_delete_resource_tag.rb +3 -3
- data/test/requests/resources/test_tag_resource.rb +3 -3
- data/test/requests/storage/test_check_storage_account_exists.rb +8 -1
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +9 -2
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +9 -2
- data/test/test_helper.rb +5 -14
- metadata +67 -75
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +0 -50
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +0 -27
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +0 -54
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +0 -35
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +0 -60
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +0 -61
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +0 -56
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +0 -58
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +0 -64
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +0 -49
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +0 -48
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +0 -36
- data/lib/fog/azurerm/requests/storage/start_backup.rb +0 -54
- data/test/api_stub/models/storage/recovery_vault.rb +0 -23
- data/test/api_stub/requests/storage/recovery_vault.rb +0 -189
- data/test/models/storage/test_recovery_vault.rb +0 -61
- data/test/models/storage/test_recovery_vaults.rb +0 -47
- data/test/requests/storage/test_create_recovery_vault.rb +0 -35
- data/test/requests/storage/test_delete_recovery_vault.rb +0 -34
- data/test/requests/storage/test_disable_backup_protection.rb +0 -52
- data/test/requests/storage/test_enable_backup_protection.rb +0 -66
- data/test/requests/storage/test_get_all_backup_jobs.rb +0 -35
- data/test/requests/storage/test_get_backup_container.rb +0 -35
- data/test/requests/storage/test_get_backup_item.rb +0 -35
- data/test/requests/storage/test_get_backup_job_for_vm.rb +0 -26
- data/test/requests/storage/test_get_backup_protection_policy.rb +0 -35
- data/test/requests/storage/test_get_recovery_vault.rb +0 -35
- data/test/requests/storage/test_list_recovery_vault.rb +0 -35
- data/test/requests/storage/test_set_recovery_vault_context.rb +0 -34
- data/test/requests/storage/test_start_backup.rb +0 -55
@@ -14,7 +14,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
14
14
|
@disks = @compute_client.disks
|
15
15
|
@get_managed_disk_response = ApiStub::Requests::Compute::VirtualMachine.get_managed_disk_response(@compute_client)
|
16
16
|
@get_vm_managed_disk_response = ApiStub::Requests::Compute::VirtualMachine.get_vm_with_managed_disk_response(@compute_client)
|
17
|
-
@input_params = {vm_name:
|
17
|
+
@input_params = { vm_name: 'fog-test-vm', vm_resource_group: 'fog-test-rg', disk_name: 'disk1', disk_size_gb: 1, storage_account_name: 'mystorage1' }
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_attach_data_disk_to_vm_success
|
@@ -37,7 +37,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
37
37
|
@virtual_machines.stub :get, @get_vm_response do
|
38
38
|
@disks.stub :get, @get_managed_disk_response do
|
39
39
|
@virtual_machines.stub :create_or_update, @get_vm_managed_disk_response do
|
40
|
-
input_params = {vm_name:
|
40
|
+
input_params = { vm_name: 'ManagedVM', vm_resource_group: 'ManagedRG', disk_name: 'ManagedDataDisk1', disk_size_gb: 100, disk_resource_group: 'ManagedRG' }
|
41
41
|
assert_equal @service.attach_data_disk_to_vm(input_params, false), @get_vm_managed_disk_response
|
42
42
|
end
|
43
43
|
end
|
@@ -16,14 +16,21 @@ class TestCheckAvailabilitySetExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_availability_set_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@availability_sets.stub :get, response do
|
21
|
+
assert !@service.check_availability_set_exists('myrg1', 'myavset1')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_availability_set_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@availability_sets.stub :get, response do
|
21
28
|
assert !@service.check_availability_set_exists('myrg1', 'myavset1')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_availability_set_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@availability_sets.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_availability_set_exists('myrg1', 'myavset1') }
|
29
36
|
end
|
@@ -16,14 +16,21 @@ class TestCheckManagedDiskExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_managed_disk_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@managed_disks.stub :get, response do
|
21
|
+
assert !@service.check_managed_disk_exists('myrg1', 'mydisk1')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_managed_disk_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@managed_disks.stub :get, response do
|
21
28
|
assert !@service.check_managed_disk_exists('myrg1', 'mydisk1')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_managed_disk_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@managed_disks.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_managed_disk_exists('myrg1', 'mydisk1') }
|
29
36
|
end
|
@@ -16,14 +16,21 @@ class TestCheckVirtualMachineExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_vm_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@virtual_machines.stub :get, response do
|
21
|
+
assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server', false)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vm_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@virtual_machines.stub :get, response do
|
21
28
|
assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server', false)
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_vm_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@virtual_machines.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server', false) }
|
29
36
|
end
|
@@ -16,14 +16,21 @@ class TestCheckVMExtensionExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_vm_extension_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@vm_extension.stub :get, response do
|
21
|
+
assert !@service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vm_extension_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@vm_extension.stub :get, response do
|
21
28
|
assert !@service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_vm_extension_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@vm_extension.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension') }
|
29
36
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __dir__)
|
2
|
+
|
3
|
+
# Test class for Create Image Request
|
4
|
+
class TestCreateImage < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@image = compute_client.images
|
9
|
+
@response = ApiStub::Requests::Compute::Image.create_image(compute_client)
|
10
|
+
@input_params = ApiStub::Requests::Compute::Image.image_params
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_create_image_success
|
14
|
+
@image.stub :create_or_update, @response do
|
15
|
+
assert_equal @service.create_image(@input_params), @response
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create_image_failure
|
20
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
21
|
+
@image.stub :create_or_update, response do
|
22
|
+
assert_raises RuntimeError do
|
23
|
+
@service.create_image(@input_params)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -10,80 +10,104 @@ class TestCreateVirtualMachine < Minitest::Test
|
|
10
10
|
@custom_data_response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_with_custom_data_response(compute_client)
|
11
11
|
@linux_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_params
|
12
12
|
@windows_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_params
|
13
|
+
@error_response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_create_linux_virtual_machine_success
|
16
17
|
@virtual_machines.stub :create_or_update, @response do
|
17
|
-
|
18
|
+
@virtual_machines.stub :get, @error_response do
|
19
|
+
assert_equal @service.create_virtual_machine(@linux_virtual_machine_hash), @response
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
# Async
|
21
24
|
@virtual_machines.stub :create_or_update_async, @response do
|
22
|
-
|
25
|
+
@virtual_machines.stub :get, @error_response do
|
26
|
+
assert_equal @service.create_virtual_machine(@linux_virtual_machine_hash, true), @response
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
25
30
|
|
26
31
|
def test_create_windows_virtual_machine_success
|
27
32
|
@virtual_machines.stub :create_or_update, @response do
|
28
|
-
|
33
|
+
@virtual_machines.stub :get, @error_response do
|
34
|
+
assert_equal @service.create_virtual_machine(@windows_virtual_machine_hash), @response
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
38
|
# Async
|
32
39
|
@virtual_machines.stub :create_or_update_async, @response do
|
33
|
-
|
40
|
+
@virtual_machines.stub :get, @error_response do
|
41
|
+
assert_equal @service.create_virtual_machine(@windows_virtual_machine_hash, true), @response
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
37
46
|
def test_create_linux_virtual_machine_from_custom_image_success
|
38
47
|
linux_virtual_machine_with_custom_image_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_with_custom_image_params
|
39
48
|
@virtual_machines.stub :create_or_update, @response do
|
40
|
-
|
49
|
+
@virtual_machines.stub :get, @error_response do
|
50
|
+
assert_equal @service.create_virtual_machine(linux_virtual_machine_with_custom_image_hash), @response
|
51
|
+
end
|
41
52
|
end
|
42
53
|
|
43
54
|
# Async
|
44
55
|
@virtual_machines.stub :create_or_update_async, @response do
|
45
|
-
|
56
|
+
@virtual_machines.stub :get, @error_response do
|
57
|
+
assert_equal @service.create_virtual_machine(linux_virtual_machine_with_custom_image_hash, true), @response
|
58
|
+
end
|
46
59
|
end
|
47
60
|
end
|
48
61
|
|
49
62
|
def test_create_windows_virtual_machine_from_custom_image_success
|
50
63
|
windows_virtual_machine_with_custom_image_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_with_custom_image_params
|
51
64
|
@virtual_machines.stub :create_or_update, @response do
|
52
|
-
|
65
|
+
@virtual_machines.stub :get, @error_response do
|
66
|
+
assert_equal @service.create_virtual_machine(windows_virtual_machine_with_custom_image_hash), @response
|
67
|
+
end
|
53
68
|
end
|
54
69
|
|
55
70
|
# Async
|
56
71
|
@virtual_machines.stub :create_or_update_async, @response do
|
57
|
-
|
72
|
+
@virtual_machines.stub :get, @error_response do
|
73
|
+
assert_equal @service.create_virtual_machine(windows_virtual_machine_with_custom_image_hash, true), @response
|
74
|
+
end
|
58
75
|
end
|
59
76
|
end
|
60
77
|
|
61
78
|
def test_create_linux_virtual_machine_with_custom_data_success
|
62
79
|
linux_virtual_machine_with_custom_data_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_with_custom_data_params
|
63
80
|
@virtual_machines.stub :create_or_update, @custom_data_response do
|
64
|
-
|
81
|
+
@virtual_machines.stub :get, @error_response do
|
82
|
+
assert_equal @service.create_virtual_machine(linux_virtual_machine_with_custom_data_hash), @custom_data_response
|
83
|
+
end
|
65
84
|
end
|
66
85
|
end
|
67
86
|
|
68
87
|
def test_create_windows_virtual_machine_with_custom_data_success
|
69
88
|
windows_virtual_machine_with_custom_data_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_with_custom_data_params
|
70
89
|
@virtual_machines.stub :create_or_update, @custom_data_response do
|
71
|
-
|
90
|
+
@virtual_machines.stub :get, @error_response do
|
91
|
+
assert_equal @service.create_virtual_machine(windows_virtual_machine_with_custom_data_hash), @custom_data_response
|
92
|
+
end
|
72
93
|
end
|
73
94
|
end
|
74
95
|
|
75
96
|
def test_create_virtual_machine_failure
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
97
|
+
@virtual_machines.stub :create_or_update, @error_response do
|
98
|
+
@virtual_machines.stub :get, @error_response do
|
99
|
+
assert_raises RuntimeError do
|
100
|
+
@service.create_virtual_machine(@linux_virtual_machine_hash)
|
101
|
+
end
|
80
102
|
end
|
81
103
|
end
|
82
104
|
|
83
105
|
# Async
|
84
|
-
@virtual_machines.stub :create_or_update_async,
|
85
|
-
|
86
|
-
|
106
|
+
@virtual_machines.stub :create_or_update_async, @error_response do
|
107
|
+
@virtual_machines.stub :get, @error_response do
|
108
|
+
assert_raises RuntimeError do
|
109
|
+
@service.create_virtual_machine(@linux_virtual_machine_hash, true)
|
110
|
+
end
|
87
111
|
end
|
88
112
|
end
|
89
113
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __dir__)
|
2
|
+
|
3
|
+
# Test class for Delete Image Request
|
4
|
+
class TestDeleteImage < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@image = compute_client.images
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_delete_image_success
|
12
|
+
@image.stub :delete, true do
|
13
|
+
assert @service.delete_image('fog-test-rg', 'fog-test-server-osImage')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_delete_image_failure
|
18
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
|
+
@image.stub :delete, response do
|
20
|
+
assert_raises(RuntimeError) { @service.delete_image('fog-test-rg', 'fog-test-server-osImage') }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __dir__)
|
2
|
+
|
3
|
+
# Test class for Get Image Request
|
4
|
+
class TestGetImage < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@image = compute_client.images
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_image_success
|
12
|
+
@image.stub :get, true do
|
13
|
+
assert @service.get_image('fog-test-rg', 'TestImage')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_image_failure
|
18
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
|
+
@image.stub :get, response do
|
20
|
+
assert_raises(RuntimeError) { @service.get_image('fog-test-rg', 'TestImage') }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -16,14 +16,21 @@ class TestCheckRecordSetExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_record_set_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'code' => 'NotFound') }
|
20
|
+
@record_sets.stub :get, response do
|
21
|
+
assert !@service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_record_set_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@record_sets.stub :get, response do
|
21
28
|
assert !@service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_record_set_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@record_sets.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME') }
|
29
36
|
end
|
@@ -15,7 +15,7 @@ class TestCheckZoneExists < Minitest::Test
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_check_zone_arguement_error
|
19
19
|
response = ApiStub::Requests::DNS::RecordSet.list_record_sets_response(@dns_client)
|
20
20
|
@zones.stub :get, response do
|
21
21
|
assert_raises ArgumentError do
|
@@ -24,8 +24,22 @@ class TestCheckZoneExists < Minitest::Test
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_check_zone_exists_failure
|
28
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
29
|
+
@zones.stub :get, response do
|
30
|
+
assert !@service.check_zone_exists('fog-test-rg', 'zone_name')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_check_zone_resource_group_exists_failure
|
35
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
36
|
+
@zones.stub :get, response do
|
37
|
+
assert !@service.check_zone_exists('fog-test-rg', 'zone_name')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
27
41
|
def test_check_zone_exists_exception
|
28
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
42
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
29
43
|
@zones.stub :get, response do
|
30
44
|
assert_raises RuntimeError do
|
31
45
|
@service.check_zone_exists('fog-test-rg', 'zone_name')
|
@@ -16,14 +16,21 @@ class TestCheckVaultExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_vault_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@vaults.stub :get, response do
|
21
|
+
assert !@service.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vault_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@vaults.stub :get, response do
|
21
28
|
assert !@service.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_vault_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@vaults.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_vault_exists('fog-test-rg', 'fog-test-kv') }
|
29
36
|
end
|
@@ -16,14 +16,21 @@ class TestCheckExpressRouteCirAuthExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_express_route_cir_auth_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'NotFound' }) }
|
20
|
+
@circuit_authorization.stub :get, response do
|
21
|
+
assert !@service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_express_route_cir_auth_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@circuit_authorization.stub :get, response do
|
21
28
|
assert !@service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_express_route_cir_auth_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@circuit_authorization.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name') }
|
29
36
|
end
|
@@ -16,14 +16,21 @@ class TestCheckExpressRouteCircuitExists < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_express_route_circuit_exists_failure
|
19
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@circuit.stub :get, response do
|
21
|
+
assert !@service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_express_route_circuit_resource_group_exists_failure
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
20
27
|
@circuit.stub :get, response do
|
21
28
|
assert !@service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit')
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_check_express_route_circuit_exists_exception
|
26
|
-
response = proc { raise MsRestAzure::AzureOperationError.new(nil,
|
33
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
27
34
|
@circuit.stub :get, response do
|
28
35
|
assert_raises(RuntimeError) { @service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit') }
|
29
36
|
end
|