fog-azure-rm 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/fog-azure-rm.gemspec +2 -3
- data/lib/fog/azurerm/constants.rb +3 -1
- data/lib/fog/azurerm/docs/compute.md +10 -4
- data/lib/fog/azurerm/models/compute/availability_set.rb +22 -1
- data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +0 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +1 -1
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +25 -11
- data/lib/fog/azurerm/utilities/general.rb +1 -1
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +0 -1
- data/test/api_stub/models/compute/availability_set.rb +24 -5
- data/test/api_stub/requests/compute/availability_set.rb +62 -5
- data/test/integration/application_gateway.rb +1 -1
- data/test/integration/availability_set.rb +103 -16
- data/test/integration/blob.rb +1 -1
- data/test/integration/container.rb +1 -1
- data/test/integration/data_disk.rb +1 -1
- data/test/integration/deployment.rb +1 -1
- data/test/integration/express_route_circuit.rb +1 -1
- data/test/integration/external_load_balancer.rb +1 -1
- data/test/integration/internal_load_balancer.rb +1 -1
- data/test/integration/key_vault.rb +1 -1
- data/test/integration/local_network_gateway.rb +1 -1
- data/test/integration/managed_disk.rb +1 -1
- data/test/integration/network_interface.rb +1 -1
- data/test/integration/network_security_group.rb +1 -1
- data/test/integration/network_security_rule.rb +1 -1
- data/test/integration/public_ip.rb +1 -1
- data/test/integration/record_set.rb +1 -1
- data/test/integration/resource_group.rb +1 -1
- data/test/integration/resource_tag.rb +1 -1
- data/test/integration/server.rb +1 -1
- data/test/integration/server_custom_image.rb +2 -2
- data/test/integration/sql_server.rb +1 -1
- data/test/integration/storage_account.rb +1 -1
- data/test/integration/subnet.rb +1 -1
- data/test/integration/traffic_manager.rb +1 -1
- data/test/integration/virtual_machine_extension.rb +2 -2
- data/test/integration/virtual_network.rb +1 -1
- data/test/integration/virtual_network_gateway.rb +3 -9
- data/test/integration/{Virtual_network_gateway_connection.rb → virtual_network_gateway_connection.rb} +3 -2
- data/test/integration/virtual_network_gateway_connection_to_express_route.rb +3 -3
- data/test/integration/zone.rb +1 -1
- data/test/models/compute/test_availability_set.rb +4 -2
- data/test/models/key_vault/test_vault.rb +1 -1
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +6 -6
- data/test/requests/compute/test_check_vm_exists.rb +3 -3
- data/test/requests/compute/test_create_availability_set.rb +87 -3
- data/test/requests/compute/test_detach_data_disk_from_vm.rb +2 -2
- data/test/requests/compute/test_get_virtual_machine.rb +2 -2
- data/test/requests/compute/test_get_vm_status.rb +2 -2
- data/test/test_helper.rb +23 -0
- metadata +46 -62
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
data/test/integration/server.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -92,7 +92,7 @@ begin
|
|
92
92
|
username: 'testuser',
|
93
93
|
password: 'Confiz=123',
|
94
94
|
disable_password_authentication: false,
|
95
|
-
|
95
|
+
network_interface_card_ids: ["/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-CustomVM/providers/Microsoft.Network/networkInterfaces/NetInt"],
|
96
96
|
platform: 'linux',
|
97
97
|
vhd_path: 'https://custimagestorage.blob.core.windows.net/newcustomvhd/trusty-server-cloudimg-amd64-disk1-zeeshan.vhd'
|
98
98
|
)
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
data/test/integration/subnet.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resources = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -87,7 +87,7 @@ begin
|
|
87
87
|
username: 'testuser',
|
88
88
|
password: 'Confiz=123',
|
89
89
|
disable_password_authentication: false,
|
90
|
-
|
90
|
+
network_interface_card_ids: ["/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VME/providers/Microsoft.Network/networkInterfaces/NetInt"],
|
91
91
|
publisher: 'MicrosoftWindowsServer',
|
92
92
|
offer: 'WindowsServer',
|
93
93
|
sku: '2008-R2-SP1',
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -81,8 +81,8 @@ begin
|
|
81
81
|
}
|
82
82
|
],
|
83
83
|
resource_group: 'TestRG-VNG',
|
84
|
-
sku_name: '
|
85
|
-
sku_tier: '
|
84
|
+
sku_name: 'Standard',
|
85
|
+
sku_tier: 'Standard',
|
86
86
|
sku_capacity: 2,
|
87
87
|
gateway_type: 'ExpressRoute',
|
88
88
|
enable_bgp: false,
|
@@ -111,12 +111,6 @@ begin
|
|
111
111
|
|
112
112
|
puts "Deleted virtual network gateway: #{network_gateway.destroy}"
|
113
113
|
|
114
|
-
pubip = network.public_ips.get('TestRG-VNG', 'mypubip')
|
115
|
-
pubip.destroy
|
116
|
-
|
117
|
-
vnet = network.virtual_networks.get('TestRG-VNG', 'testVnet')
|
118
|
-
vnet.destroy
|
119
|
-
|
120
114
|
rg = resource.resource_groups.get('TestRG-VNG')
|
121
115
|
rg.destroy
|
122
116
|
rescue
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -214,7 +214,8 @@ begin
|
|
214
214
|
|
215
215
|
resource_group = resource.resource_groups.get('TestRG-GC')
|
216
216
|
resource_group.destroy
|
217
|
-
rescue
|
217
|
+
rescue Exception => e
|
218
|
+
raise e
|
218
219
|
puts 'Integration Test for virtual network gateway connection is failing'
|
219
220
|
resource_group.destroy unless resource_group.nil?
|
220
221
|
end
|
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -70,8 +70,8 @@ begin
|
|
70
70
|
}
|
71
71
|
],
|
72
72
|
resource_group: 'TestRG-GCE',
|
73
|
-
sku_name: '
|
74
|
-
sku_tier: '
|
73
|
+
sku_name: 'Standard',
|
74
|
+
sku_tier: 'Standard',
|
75
75
|
sku_capacity: 2,
|
76
76
|
gateway_type: 'ExpressRoute',
|
77
77
|
enable_bgp: false,
|
data/test/integration/zone.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
###################### Keep it Uncommented! ######################
|
7
7
|
########################################################################################################################
|
8
8
|
|
9
|
-
azure_credentials = YAML.load_file('credentials/azure.yml')
|
9
|
+
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
10
|
|
11
11
|
rs = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
@@ -6,7 +6,7 @@ class TestAvailabilitySet < Minitest::Test
|
|
6
6
|
@service = Fog::Compute::AzureRM.new(credentials)
|
7
7
|
@availability_set = availability_set(@service)
|
8
8
|
compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
9
|
-
@response = ApiStub::Models::Compute::AvailabilitySet.
|
9
|
+
@response = ApiStub::Models::Compute::AvailabilitySet.create_unmanaged_availability_set_response(compute_client)
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_model_methods
|
@@ -27,7 +27,9 @@ class TestAvailabilitySet < Minitest::Test
|
|
27
27
|
:location,
|
28
28
|
:resource_group,
|
29
29
|
:platform_update_domain_count,
|
30
|
-
:platform_fault_domain_count
|
30
|
+
:platform_fault_domain_count,
|
31
|
+
:use_managed_disk,
|
32
|
+
:sku_name
|
31
33
|
]
|
32
34
|
attributes.each do |attribute|
|
33
35
|
assert_respond_to @availability_set, attribute
|
@@ -20,7 +20,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
20
20
|
@virtual_machines.stub :get, @get_vm_response do
|
21
21
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
22
22
|
@virtual_machines.stub :create_or_update, @update_vm_response do
|
23
|
-
assert_equal @service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1'), @update_vm_response
|
23
|
+
assert_equal @service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false), @update_vm_response
|
24
24
|
blob_service.verify
|
25
25
|
end
|
26
26
|
end
|
@@ -35,7 +35,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
35
35
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
36
36
|
@virtual_machines.stub :create_or_update, @update_vm_response do
|
37
37
|
assert_raises RuntimeError do
|
38
|
-
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1')
|
38
|
+
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -48,7 +48,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
48
48
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
49
49
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
50
50
|
assert_raises RuntimeError do
|
51
|
-
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1')
|
51
|
+
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -61,7 +61,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
61
61
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
62
62
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
63
63
|
assert_raises RuntimeError do
|
64
|
-
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1')
|
64
|
+
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -72,7 +72,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
72
72
|
get_vm_response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
73
73
|
@virtual_machines.stub :get, get_vm_response do
|
74
74
|
assert_raises RuntimeError do
|
75
|
-
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1')
|
75
|
+
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -82,7 +82,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
82
82
|
@virtual_machines.stub :get, @get_vm_response do
|
83
83
|
@storage_accounts.stub :list_keys, storage_access_keys_response do
|
84
84
|
assert_raises RuntimeError do
|
85
|
-
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1')
|
85
|
+
@service.attach_data_disk_to_vm('fog-test-rg', 'fog-test-vm', 'disk1', 1, 'mystorage1', false)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -11,21 +11,21 @@ class TestCheckVirtualMachineExists < Minitest::Test
|
|
11
11
|
def test_check_vm_exists_success
|
12
12
|
response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_response(@compute_client)
|
13
13
|
@virtual_machines.stub :get, response do
|
14
|
-
assert @service.check_vm_exists('fog-test-rg', 'fog-test-server')
|
14
|
+
assert @service.check_vm_exists('fog-test-rg', 'fog-test-server', false)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_check_vm_exists_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
20
|
@virtual_machines.stub :get, response do
|
21
|
-
assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server')
|
21
|
+
assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server', false)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_check_vm_exists_exception
|
26
26
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
27
|
@virtual_machines.stub :get, response do
|
28
|
-
assert_raises(RuntimeError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server') }
|
28
|
+
assert_raises(RuntimeError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server', false) }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -10,18 +10,102 @@ class TestCreateAvailabilitySet < Minitest::Test
|
|
10
10
|
|
11
11
|
def test_create_availability_set_success
|
12
12
|
mocked_response = ApiStub::Requests::Compute::AvailabilitySet.create_availability_set_response(@client)
|
13
|
+
avail_set_params =
|
14
|
+
{
|
15
|
+
name: 'myavset1',
|
16
|
+
location: 'west us',
|
17
|
+
resource_group: 'fog-test-rg'
|
18
|
+
}
|
19
|
+
|
20
|
+
@availability_sets.stub :validate_params, true do
|
21
|
+
@availability_sets.stub :create_or_update, mocked_response do
|
22
|
+
assert_equal @service.create_availability_set(avail_set_params), mocked_response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_create_custom_availability_set_success
|
28
|
+
mocked_response = ApiStub::Requests::Compute::AvailabilitySet.create_custom_availability_set_response(@client)
|
29
|
+
avail_set_params =
|
30
|
+
{
|
31
|
+
name: 'myavset1',
|
32
|
+
location: 'west us',
|
33
|
+
resource_group: 'fog-test-rg',
|
34
|
+
platform_fault_domain_count: 3,
|
35
|
+
platform_update_domain_count: 10
|
36
|
+
}
|
37
|
+
|
13
38
|
@availability_sets.stub :validate_params, true do
|
14
39
|
@availability_sets.stub :create_or_update, mocked_response do
|
15
|
-
assert_equal @service.create_availability_set(
|
40
|
+
assert_equal @service.create_availability_set(avail_set_params), mocked_response
|
16
41
|
end
|
17
42
|
end
|
18
43
|
end
|
19
44
|
|
20
|
-
def
|
45
|
+
def test_create_unmanaged_availability_set_success
|
46
|
+
mocked_response = ApiStub::Requests::Compute::AvailabilitySet.create_unmanaged_availability_set_response(@client)
|
47
|
+
avail_set_params =
|
48
|
+
{
|
49
|
+
name: 'myavset1',
|
50
|
+
location: 'west us',
|
51
|
+
resource_group: 'fog-test-rg',
|
52
|
+
use_managed_disk: false
|
53
|
+
}
|
54
|
+
|
55
|
+
@availability_sets.stub :validate_params, true do
|
56
|
+
@availability_sets.stub :create_or_update, mocked_response do
|
57
|
+
assert_equal @service.create_availability_set(avail_set_params), mocked_response
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_create_unmanaged_availability_set_failure
|
21
63
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
64
|
+
avail_set_params =
|
65
|
+
{
|
66
|
+
name: 'myavset1',
|
67
|
+
location: 'west us',
|
68
|
+
resource_group: 'fog-test-rg',
|
69
|
+
use_managed_disk: false
|
70
|
+
}
|
71
|
+
|
72
|
+
@availability_sets.stub :validate_params, true do
|
73
|
+
@availability_sets.stub :create_or_update, response do
|
74
|
+
assert_raises(RuntimeError) { @service.create_availability_set(avail_set_params) }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_create_managed_availability_set_success
|
80
|
+
mocked_response = ApiStub::Requests::Compute::AvailabilitySet.create_managed_availability_set_response(@client)
|
81
|
+
avail_set_params =
|
82
|
+
{
|
83
|
+
name: 'myavset1',
|
84
|
+
location: 'west us',
|
85
|
+
resource_group: 'fog-test-rg',
|
86
|
+
use_managed_disk: true
|
87
|
+
}
|
88
|
+
|
89
|
+
@availability_sets.stub :validate_params, true do
|
90
|
+
@availability_sets.stub :create_or_update, mocked_response do
|
91
|
+
assert_equal @service.create_availability_set(avail_set_params), mocked_response
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_create_managed_availability_set_failure
|
97
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
98
|
+
avail_set_params =
|
99
|
+
{
|
100
|
+
name: 'myavset1',
|
101
|
+
location: 'west us',
|
102
|
+
resource_group: 'fog-test-rg',
|
103
|
+
use_managed_disk: true
|
104
|
+
}
|
105
|
+
|
22
106
|
@availability_sets.stub :validate_params, true do
|
23
107
|
@availability_sets.stub :create_or_update, response do
|
24
|
-
assert_raises(RuntimeError) { @service.create_availability_set(
|
108
|
+
assert_raises(RuntimeError) { @service.create_availability_set(avail_set_params) }
|
25
109
|
end
|
26
110
|
end
|
27
111
|
end
|
@@ -13,7 +13,7 @@ class TestDetachDataDiskFromVM < Minitest::Test
|
|
13
13
|
update_vm_response = ApiStub::Requests::Compute::VirtualMachine.detach_data_disk_from_vm_response(@compute_client)
|
14
14
|
@virtual_machines.stub :get, get_vm_response do
|
15
15
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
16
|
-
assert_equal @service.detach_data_disk_from_vm('fog-test-rg', 'fog-test-vm', 'mydatadisk1'), update_vm_response
|
16
|
+
assert_equal @service.detach_data_disk_from_vm('fog-test-rg', 'fog-test-vm', 'mydatadisk1', false), update_vm_response
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -24,7 +24,7 @@ class TestDetachDataDiskFromVM < Minitest::Test
|
|
24
24
|
@virtual_machines.stub :get, get_vm_response do
|
25
25
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
26
26
|
assert_raises RuntimeError do
|
27
|
-
@service.detach_data_disk_from_vm('fog-test-rg', 'fog-test-vm', 'mydatadisk1')
|
27
|
+
@service.detach_data_disk_from_vm('fog-test-rg', 'fog-test-vm', 'mydatadisk1', false)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -11,14 +11,14 @@ class TestGetVirtualMachine < Minitest::Test
|
|
11
11
|
def test_get_virtual_machine_success
|
12
12
|
response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_response(@compute_client)
|
13
13
|
@virtual_machines.stub :get, response do
|
14
|
-
assert_equal @service.get_virtual_machine('fog-test-rg', 'fog-test-server'), response
|
14
|
+
assert_equal @service.get_virtual_machine('fog-test-rg', 'fog-test-server', false), response
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_get_virtual_machine_failure
|
19
19
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@virtual_machines.stub :get, response do
|
21
|
-
assert_raises(RuntimeError) { @service.get_virtual_machine('fog-test-rg', 'fog-test-server') }
|
21
|
+
assert_raises(RuntimeError) { @service.get_virtual_machine('fog-test-rg', 'fog-test-server', false) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -12,14 +12,14 @@ class TestGetVirtualMachineStatus < Minitest::Test
|
|
12
12
|
response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_instance_view_response(@compute_client)
|
13
13
|
compare_result = ApiStub::Requests::Compute::VirtualMachine.vm_status_response
|
14
14
|
@virtual_machines.stub :get, response do
|
15
|
-
assert_equal @service.check_vm_status('fog-test-rg', 'fog-test-server'), compare_result
|
15
|
+
assert_equal @service.check_vm_status('fog-test-rg', 'fog-test-server', false), compare_result
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_vm_status_failure
|
20
20
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
21
21
|
@virtual_machines.stub :get, response do
|
22
|
-
assert_raises(RuntimeError) { @service.check_vm_status('fog-test-rg', 'fog-test-server') }
|
22
|
+
assert_raises(RuntimeError) { @service.check_vm_status('fog-test-rg', 'fog-test-server', false) }
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/test/test_helper.rb
CHANGED
@@ -116,6 +116,8 @@ def availability_set(service)
|
|
116
116
|
name: 'availability-set',
|
117
117
|
location: 'West US',
|
118
118
|
resource_group: 'fog-test-rg',
|
119
|
+
use_managed_disk: false,
|
120
|
+
sku_name: 'Classic',
|
119
121
|
service: service
|
120
122
|
)
|
121
123
|
end
|
@@ -815,3 +817,24 @@ def managed_disk(service)
|
|
815
817
|
service: service
|
816
818
|
)
|
817
819
|
end
|
820
|
+
|
821
|
+
def key_vault(service)
|
822
|
+
Fog::KeyVault::AzureRM::Vault.new(
|
823
|
+
name: 'key-vault',
|
824
|
+
location: 'East US',
|
825
|
+
resource_group_name: 'fog-test-rg',
|
826
|
+
sku_family: 'A',
|
827
|
+
sku_name: 'Standard',
|
828
|
+
access_policies: [
|
829
|
+
{
|
830
|
+
tenant_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
|
831
|
+
object_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
|
832
|
+
permissions: {
|
833
|
+
keys: ['all'],
|
834
|
+
secrets: ['all']
|
835
|
+
}
|
836
|
+
}
|
837
|
+
],
|
838
|
+
service: service
|
839
|
+
)
|
840
|
+
end
|