fog-azure-rm-temp 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/fog-azure-rm.gemspec +2 -2
  4. data/lib/fog/azurerm/constants.rb +3 -1
  5. data/lib/fog/azurerm/docs/compute.md +10 -4
  6. data/lib/fog/azurerm/models/compute/availability_set.rb +22 -1
  7. data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +0 -4
  8. data/lib/fog/azurerm/models/network/network_interface.rb +0 -2
  9. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +1 -1
  10. data/lib/fog/azurerm/requests/compute/create_availability_set.rb +25 -11
  11. data/lib/fog/azurerm/utilities/general.rb +1 -1
  12. data/lib/fog/azurerm/version.rb +1 -1
  13. data/test/api_stub/models/compute/availability_set.rb +24 -5
  14. data/test/api_stub/requests/compute/availability_set.rb +60 -3
  15. data/test/integration/application_gateway.rb +1 -1
  16. data/test/integration/availability_set.rb +103 -16
  17. data/test/integration/blob.rb +1 -1
  18. data/test/integration/container.rb +1 -1
  19. data/test/integration/data_disk.rb +1 -1
  20. data/test/integration/deployment.rb +1 -1
  21. data/test/integration/express_route_circuit.rb +1 -1
  22. data/test/integration/external_load_balancer.rb +1 -1
  23. data/test/integration/internal_load_balancer.rb +1 -1
  24. data/test/integration/key_vault.rb +1 -1
  25. data/test/integration/local_network_gateway.rb +1 -1
  26. data/test/integration/managed_disk.rb +1 -1
  27. data/test/integration/network_interface.rb +1 -1
  28. data/test/integration/network_security_group.rb +1 -1
  29. data/test/integration/network_security_rule.rb +1 -1
  30. data/test/integration/public_ip.rb +1 -1
  31. data/test/integration/record_set.rb +1 -1
  32. data/test/integration/resource_group.rb +1 -1
  33. data/test/integration/resource_tag.rb +1 -1
  34. data/test/integration/server.rb +1 -1
  35. data/test/integration/server_custom_image.rb +2 -2
  36. data/test/integration/sql_server.rb +1 -1
  37. data/test/integration/storage_account.rb +1 -1
  38. data/test/integration/subnet.rb +1 -1
  39. data/test/integration/traffic_manager.rb +1 -1
  40. data/test/integration/virtual_machine_extension.rb +2 -2
  41. data/test/integration/virtual_network.rb +1 -1
  42. data/test/integration/virtual_network_gateway.rb +3 -9
  43. data/test/integration/{Virtual_network_gateway_connection.rb → virtual_network_gateway_connection.rb} +3 -2
  44. data/test/integration/virtual_network_gateway_connection_to_express_route.rb +3 -3
  45. data/test/integration/zone.rb +1 -1
  46. data/test/models/compute/test_availability_set.rb +4 -2
  47. data/test/models/key_vault/test_vault.rb +1 -1
  48. data/test/requests/compute/test_attach_data_disk_to_vm.rb +6 -6
  49. data/test/requests/compute/test_check_vm_exists.rb +3 -3
  50. data/test/requests/compute/test_create_availability_set.rb +87 -3
  51. data/test/requests/compute/test_detach_data_disk_from_vm.rb +2 -2
  52. data/test/requests/compute/test_get_virtual_machine.rb +2 -2
  53. data/test/requests/compute/test_get_vm_status.rb +2 -2
  54. data/test/test_helper.rb +23 -0
  55. metadata +10 -12
@@ -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('fog-test-rg', 'myavset1', 'west us'), mocked_response
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 test_create_availability_set_failure
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
+ is_managed: 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
+ is_managed: 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
+ is_managed: 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
+ is_managed: 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('fog-test-rg', 'fog-test-as', 'west us') }
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
+ is_managed: 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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-azure-rm-temp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaffan Chaudhry
@@ -11,10 +11,14 @@ authors:
11
11
  - Haider Ali
12
12
  - Waqar Haider
13
13
  - Bilal Naeem
14
+ - Muhammad Asad
15
+ - Azeem Sajid
16
+ - Maham Nazir
17
+ - Abbas Sheikh
14
18
  autorequire:
15
19
  bindir: bin
16
20
  cert_chain: []
17
- date: 2017-09-15 00:00:00.000000000 Z
21
+ date: 2017-09-22 00:00:00.000000000 Z
18
22
  dependencies:
19
23
  - !ruby/object:Gem::Dependency
20
24
  name: rake
@@ -216,22 +220,16 @@ dependencies:
216
220
  name: azure-storage
217
221
  requirement: !ruby/object:Gem::Requirement
218
222
  requirements:
219
- - - '>='
223
+ - - '='
220
224
  - !ruby/object:Gem::Version
221
225
  version: 0.11.5.preview
222
- - - <
223
- - !ruby/object:Gem::Version
224
- version: '1.0'
225
226
  type: :runtime
226
227
  prerelease: false
227
228
  version_requirements: !ruby/object:Gem::Requirement
228
229
  requirements:
229
- - - '>='
230
+ - - '='
230
231
  - !ruby/object:Gem::Version
231
232
  version: 0.11.5.preview
232
- - - <
233
- - !ruby/object:Gem::Version
234
- version: '1.0'
235
233
  - !ruby/object:Gem::Dependency
236
234
  name: vhd
237
235
  requirement: !ruby/object:Gem::Requirement
@@ -709,7 +707,6 @@ files:
709
707
  - test/api_stub/requests/traffic_manager/traffic_manager_endpoint.rb
710
708
  - test/api_stub/requests/traffic_manager/traffic_manager_profile.rb
711
709
  - test/integration/README.md
712
- - test/integration/Virtual_network_gateway_connection.rb
713
710
  - test/integration/application_gateway.rb
714
711
  - test/integration/availability_set.rb
715
712
  - test/integration/blob.rb
@@ -739,6 +736,7 @@ files:
739
736
  - test/integration/virtual_machine_extension.rb
740
737
  - test/integration/virtual_network.rb
741
738
  - test/integration/virtual_network_gateway.rb
739
+ - test/integration/virtual_network_gateway_connection.rb
742
740
  - test/integration/virtual_network_gateway_connection_to_express_route.rb
743
741
  - test/integration/zone.rb
744
742
  - test/models/application_gateway/test_gateway.rb
@@ -1067,7 +1065,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1067
1065
  version: '0'
1068
1066
  requirements: []
1069
1067
  rubyforge_project:
1070
- rubygems_version: 2.6.12
1068
+ rubygems_version: 2.4.8
1071
1069
  signing_key:
1072
1070
  specification_version: 4
1073
1071
  summary: Module for the 'fog' gem to support Azure Resource Manager cloud services.