fog-profitbricks 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.travis.yml +11 -4
  4. data/README.md +8 -5
  5. data/Rakefile +1 -1
  6. data/examples/pb_demo.rb +49 -49
  7. data/fog-profitbricks.gemspec +4 -5
  8. data/gemfiles/Gemfile.1.9.2+ +1 -0
  9. data/lib/fog/bin/profitbricks.rb +5 -5
  10. data/lib/fog/profitbricks.rb +3 -3
  11. data/lib/fog/profitbricks/compute.rb +209 -204
  12. data/lib/fog/profitbricks/helpers/compute/data_helper.rb +1 -1
  13. data/lib/fog/profitbricks/models/compute/datacenter.rb +1 -1
  14. data/lib/fog/profitbricks/models/compute/datacenters.rb +6 -7
  15. data/lib/fog/profitbricks/models/compute/firewall_rule.rb +2 -2
  16. data/lib/fog/profitbricks/models/compute/firewall_rules.rb +5 -8
  17. data/lib/fog/profitbricks/models/compute/flavors.rb +1 -4
  18. data/lib/fog/profitbricks/models/compute/image.rb +4 -0
  19. data/lib/fog/profitbricks/models/compute/images.rb +2 -5
  20. data/lib/fog/profitbricks/models/compute/ip_block.rb +1 -1
  21. data/lib/fog/profitbricks/models/compute/ip_blocks.rb +3 -8
  22. data/lib/fog/profitbricks/models/compute/lan.rb +1 -1
  23. data/lib/fog/profitbricks/models/compute/lans.rb +4 -7
  24. data/lib/fog/profitbricks/models/compute/load_balancer.rb +6 -7
  25. data/lib/fog/profitbricks/models/compute/load_balancers.rb +5 -9
  26. data/lib/fog/profitbricks/models/compute/locations.rb +2 -5
  27. data/lib/fog/profitbricks/models/compute/nic.rb +6 -3
  28. data/lib/fog/profitbricks/models/compute/nics.rb +2 -5
  29. data/lib/fog/profitbricks/models/compute/regions.rb +1 -4
  30. data/lib/fog/profitbricks/models/compute/request.rb +0 -1
  31. data/lib/fog/profitbricks/models/compute/requests.rb +2 -4
  32. data/lib/fog/profitbricks/models/compute/server.rb +10 -13
  33. data/lib/fog/profitbricks/models/compute/servers.rb +3 -6
  34. data/lib/fog/profitbricks/models/compute/snapshot.rb +2 -2
  35. data/lib/fog/profitbricks/models/compute/snapshots.rb +3 -6
  36. data/lib/fog/profitbricks/models/compute/volume.rb +11 -9
  37. data/lib/fog/profitbricks/models/compute/volumes.rb +3 -6
  38. data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +26 -13
  39. data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +25 -16
  40. data/lib/fog/profitbricks/requests/compute/attach_volume.rb +25 -16
  41. data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +22 -23
  42. data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +24 -26
  43. data/lib/fog/profitbricks/requests/compute/create_flavor.rb +34 -34
  44. data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +18 -20
  45. data/lib/fog/profitbricks/requests/compute/create_lan.rb +151 -150
  46. data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +67 -26
  47. data/lib/fog/profitbricks/requests/compute/create_nic.rb +24 -26
  48. data/lib/fog/profitbricks/requests/compute/create_server.rb +70 -61
  49. data/lib/fog/profitbricks/requests/compute/create_volume.rb +122 -122
  50. data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +42 -45
  51. data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +34 -36
  52. data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +8 -11
  53. data/lib/fog/profitbricks/requests/compute/delete_image.rb +7 -9
  54. data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +8 -10
  55. data/lib/fog/profitbricks/requests/compute/delete_lan.rb +7 -9
  56. data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +8 -10
  57. data/lib/fog/profitbricks/requests/compute/delete_nic.rb +7 -10
  58. data/lib/fog/profitbricks/requests/compute/delete_server.rb +6 -10
  59. data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +7 -10
  60. data/lib/fog/profitbricks/requests/compute/delete_volume.rb +36 -38
  61. data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +11 -13
  62. data/lib/fog/profitbricks/requests/compute/detach_volume.rb +16 -13
  63. data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +1 -1
  64. data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +6 -7
  65. data/lib/fog/profitbricks/requests/compute/get_all_flavors.rb +72 -72
  66. data/lib/fog/profitbricks/requests/compute/get_all_images.rb +62 -62
  67. data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +5 -5
  68. data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +113 -113
  69. data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +15 -9
  70. data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +9 -9
  71. data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +6 -6
  72. data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +94 -94
  73. data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +38 -38
  74. data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +8 -9
  75. data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +4 -4
  76. data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +71 -71
  77. data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +11 -11
  78. data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +16 -11
  79. data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +4 -6
  80. data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +8 -11
  81. data/lib/fog/profitbricks/requests/compute/get_flavor.rb +9 -9
  82. data/lib/fog/profitbricks/requests/compute/get_image.rb +7 -9
  83. data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +8 -10
  84. data/lib/fog/profitbricks/requests/compute/get_lan.rb +7 -10
  85. data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +16 -12
  86. data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +7 -9
  87. data/lib/fog/profitbricks/requests/compute/get_location.rb +7 -9
  88. data/lib/fog/profitbricks/requests/compute/get_nic.rb +8 -11
  89. data/lib/fog/profitbricks/requests/compute/get_request.rb +55 -57
  90. data/lib/fog/profitbricks/requests/compute/get_request_status.rb +44 -46
  91. data/lib/fog/profitbricks/requests/compute/get_server.rb +7 -10
  92. data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +7 -9
  93. data/lib/fog/profitbricks/requests/compute/get_volume.rb +7 -9
  94. data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +8 -8
  95. data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +18 -8
  96. data/lib/fog/profitbricks/requests/compute/reboot_server.rb +7 -11
  97. data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +9 -11
  98. data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +15 -17
  99. data/lib/fog/profitbricks/requests/compute/start_server.rb +7 -11
  100. data/lib/fog/profitbricks/requests/compute/stop_server.rb +7 -11
  101. data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +20 -15
  102. data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +9 -11
  103. data/lib/fog/profitbricks/requests/compute/update_image.rb +15 -15
  104. data/lib/fog/profitbricks/requests/compute/update_lan.rb +6 -8
  105. data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +10 -12
  106. data/lib/fog/profitbricks/requests/compute/update_nic.rb +10 -12
  107. data/lib/fog/profitbricks/requests/compute/update_server.rb +10 -13
  108. data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +10 -13
  109. data/lib/fog/profitbricks/requests/compute/update_volume.rb +10 -13
  110. data/lib/fog/profitbricks/version.rb +1 -1
  111. data/spec/minitest_helper.rb +1 -3
  112. data/tests/helpers/formats_helper.rb +8 -8
  113. data/tests/profitbricks/models/compute/compute_tests.rb +529 -0
  114. data/tests/profitbricks/requests/compute/composite_create_tests.rb +16 -83
  115. data/tests/profitbricks/requests/compute/flavor_tests.rb +1 -4
  116. data/tests/profitbricks/requests/compute/location_tests.rb +14 -17
  117. data/tests/profitbricks/requests/compute/nic_tests.rb +60 -70
  118. data/tests/profitbricks/requests/compute/request_tests.rb +1 -3
  119. data/tests/profitbricks/requests/compute/server_tests.rb +163 -161
  120. metadata +5 -18
@@ -1,24 +1,22 @@
1
- Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['profitbricks', 'compute']) do
2
-
1
+ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', %w(profitbricks compute)) do
3
2
  @resource_schema = {
4
- 'id' => String,
5
- 'type' => String,
6
- 'href' => String,
7
- 'metadata' => Hash,
8
- 'properties' => Hash
3
+ 'id' => String,
4
+ 'type' => String,
5
+ 'href' => String,
6
+ 'metadata' => Hash,
7
+ 'properties' => Hash
9
8
  }
10
9
 
11
10
  @minimal_schema_with_items = {
12
- 'id' => String,
13
- 'type' => String,
14
- 'href' => String,
15
- 'items' => Array
11
+ 'id' => String,
12
+ 'type' => String,
13
+ 'href' => String,
14
+ 'items' => Array
16
15
  }
17
16
 
18
17
  service = Fog::Compute[:profitbricks]
19
18
 
20
19
  tests('success') do
21
-
22
20
  Excon.defaults[:connection_timeout] = 500
23
21
 
24
22
  tests('#create_datacenter').data_matches_schema(@resource_schema) do
@@ -30,9 +28,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
30
28
  createDatacenterResponse = service.create_datacenter(options)
31
29
  @datacenter_id = createDatacenterResponse.body['id']
32
30
 
33
- if ENV["FOG_MOCK"] != "true"
34
- service.datacenters.get(@datacenter_id).wait_for { ready? }
35
- end
31
+ sleep(60) if ENV["FOG_MOCK"] != "true"
36
32
 
37
33
  createDatacenterResponse.body
38
34
  end
@@ -56,10 +52,6 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
56
52
  @datacenter_id, options
57
53
  )
58
54
 
59
- if ENV["FOG_MOCK"] != "true"
60
- service.datacenters.get(@datacenter_id).wait_for { ready? }
61
- end
62
-
63
55
  updateDatacenterResponse.body
64
56
  end
65
57
 
@@ -71,15 +63,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
71
63
  createLanResponse = service.create_lan(@datacenter_id, options)
72
64
  @lan_id = createLanResponse.body['id']
73
65
 
74
- if ENV["FOG_MOCK"] != "true"
75
- loop do
76
- sleep(180)
77
- lan = service.lans.get(@datacenter_id, @lan_id)
78
- break unless !lan.ready?
79
- end
80
-
81
- service.datacenters.get(@datacenter_id).wait_for { ready? }
82
- end
66
+ sleep(60) if ENV["FOG_MOCK"] != "true"
83
67
 
84
68
  createLanResponse.body
85
69
  end
@@ -105,7 +89,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
105
89
  :size => 5,
106
90
  :licenceType => 'LINUX',
107
91
  :type => 'HDD'
108
- }
92
+ }
109
93
  }
110
94
  ]
111
95
 
@@ -117,7 +101,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
117
101
  :lan => @lan_id
118
102
  },
119
103
 
120
- :entities => {
104
+ :entities => {
121
105
  :firewallrules => {
122
106
  :items => [
123
107
  {
@@ -137,16 +121,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
137
121
  createServerResponse = service.create_server(@datacenter_id, properties, entities)
138
122
  @server_id = createServerResponse.body['id']
139
123
 
140
- if ENV["FOG_MOCK"] != "true"
141
- loop do
142
- sleep(480)
143
- server = service.servers.get(@datacenter_id, @server_id)
144
- break unless !server.ready?
145
- end
146
- end
147
-
148
- # Calling wait_for causes ArgumentError
149
- # server.wait_for { ready? }
124
+ sleep(60) if ENV["FOG_MOCK"] != "true"
150
125
 
151
126
  createServerResponse.body
152
127
  end
@@ -157,18 +132,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
157
132
  end
158
133
 
159
134
  tests('#update_server').data_matches_schema(@resource_schema) do
160
- updateServerResponse = service.update_server(@datacenter_id, @server_id, { 'name' => 'FogTestServer_2_Rename' })
161
-
162
- if ENV["FOG_MOCK"] != "true"
163
- loop do
164
- server = service.servers.get(@datacenter_id, @server_id)
165
- sleep(1)
166
- break unless !server.ready?
167
- end
168
- end
169
-
170
- # Calling wait_for causes ArgumentError
171
- # server.wait_for { ready? }
135
+ updateServerResponse = service.update_server(@datacenter_id, @server_id, 'name' => 'FogTestServer_2_Rename')
172
136
 
173
137
  updateServerResponse.body
174
138
  end
@@ -182,48 +146,18 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
182
146
  tests('#stop_server').succeeds do
183
147
  stopServerResponse = service.stop_server(@datacenter_id, @server_id)
184
148
 
185
- if ENV["FOG_MOCK"] != "true"
186
- loop do
187
- server = service.servers.get(@datacenter_id, @server_id)
188
- sleep(1)
189
- break unless !server.shutoff?
190
- end
191
- end
192
-
193
- # Calling wait_for causes ArgumentError
194
- # server.wait_for { shutoff? }
195
-
196
149
  stopServerResponse.status == 202
197
150
  end
198
151
 
199
152
  tests('#start_server').succeeds do
200
153
  startServerResponse = service.start_server(@datacenter_id, @server_id)
201
154
 
202
- if ENV["FOG_MOCK"] != "true"
203
- loop do
204
- server = service.servers.get(@datacenter_id, @server_id)
205
- sleep(1)
206
- break unless !server.running?
207
- end
208
- end
209
-
210
- # Calling wait_for causes ArgumentError
211
- # server.wait_for { running? }
212
-
213
155
  startServerResponse.status == 202
214
156
  end
215
157
 
216
158
  tests('#reboot_server').succeeds do
217
159
  rebootServerResponse = service.reboot_server(@datacenter_id, @server_id)
218
160
 
219
- if ENV["FOG_MOCK"] != "true"
220
- loop do
221
- server = service.servers.get(@datacenter_id, @server_id)
222
- sleep(1)
223
- break unless !server.running?
224
- end
225
- end
226
-
227
161
  rebootServerResponse.status == 202
228
162
  end
229
163
 
@@ -237,5 +171,4 @@ Shindo.tests('Fog::Compute[:profitbricks] | composite create server request', ['
237
171
  deleteDatacenterResponse.status == 202
238
172
  end
239
173
  end
240
-
241
174
  end
@@ -1,5 +1,4 @@
1
- Shindo.tests('Fog::Compute[:profitbricks] | flavor request', ['profitbricks', 'compute']) do
2
-
1
+ Shindo.tests('Fog::Compute[:profitbricks] | flavor request', %w(profitbricks compute)) do
3
2
  @flavor_format = {
4
3
  'flavorId' => String,
5
4
  'flavorName' => String,
@@ -10,7 +9,6 @@ Shindo.tests('Fog::Compute[:profitbricks] | flavor request', ['profitbricks', 'c
10
9
  service = Fog::Compute[:profitbricks]
11
10
 
12
11
  tests('success') do
13
-
14
12
  # Not yet implemented
15
13
  # tests('#create_flavor').formats(@flavor_format) do
16
14
  # puts '#create_flavor'
@@ -30,7 +28,6 @@ Shindo.tests('Fog::Compute[:profitbricks] | flavor request', ['profitbricks', 'c
30
28
  data = service.get_flavor(@flavor_id)
31
29
  data.body['getFlavorResponse']
32
30
  end
33
-
34
31
  end
35
32
 
36
33
  tests('failure') do
@@ -1,5 +1,4 @@
1
- Shindo.tests('Fog::Compute[:profitbricks] | location request', ['profitbricks', 'compute']) do
2
-
1
+ Shindo.tests('Fog::Compute[:profitbricks] | location request', %w(profitbricks compute)) do
3
2
  @locations_schema = {
4
3
  'id' => String,
5
4
  'type' => String,
@@ -8,19 +7,18 @@ Shindo.tests('Fog::Compute[:profitbricks] | location request', ['profitbricks',
8
7
  }
9
8
 
10
9
  @location_schema = {
11
- 'id' => String,
12
- 'type' => String,
13
- 'href' => String,
14
- 'properties' => {
15
- 'name' => String,
16
- 'features' => Array
17
- }
10
+ 'id' => String,
11
+ 'type' => String,
12
+ 'href' => String,
13
+ 'properties' => {
14
+ 'name' => String,
15
+ 'features' => Array
16
+ }
18
17
  }
19
18
 
20
19
  service = Fog::Compute[:profitbricks]
21
20
 
22
21
  tests('success') do
23
-
24
22
  Excon.defaults[:connection_timeout] = 500
25
23
 
26
24
  tests('#get_all_locations').data_matches_schema(@locations_schema) do
@@ -30,16 +28,15 @@ Shindo.tests('Fog::Compute[:profitbricks] | location request', ['profitbricks',
30
28
  data.body
31
29
  end
32
30
 
33
- tests('#get_location').data_matches_schema(@location_schema) do
34
- data = service.get_location(@location_id)
35
- data.body
36
- end
37
-
31
+ # tests('#get_location').data_matches_schema(@location_schema) do
32
+ # data = service.get_location("us/las")
33
+ # data.body
34
+ # end
38
35
  end
39
36
 
40
37
  tests('failure') do
41
- tests('#get_location').raises(Fog::Errors::NotFound) do
42
- data = service.get_location('00000000-0000-0000-0000-000000000000')
38
+ tests('#get_location').raises(Excon::Error::HTTPStatus) do
39
+ data = service.get_location('oo/ooo')
43
40
  end
44
41
  end
45
42
  end
@@ -1,33 +1,31 @@
1
- Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'compute']) do
2
-
1
+ Shindo.tests('Fog::Compute[:profitbricks] | nic request', %w(profitbricks compute)) do
3
2
  @resource_schema = {
4
- 'id' => String,
5
- 'type' => String,
6
- 'href' => String,
7
- 'metadata' => Hash,
8
- 'properties' => Hash
3
+ 'id' => String,
4
+ 'type' => String,
5
+ 'href' => String,
6
+ 'metadata' => Hash,
7
+ 'properties' => Hash
9
8
  }
10
9
 
11
10
  @extended_resource_schema = {
12
- 'id' => String,
13
- 'type' => String,
14
- 'href' => String,
15
- 'metadata' => Hash,
16
- 'properties' => Hash,
17
- 'entities' => Hash,
11
+ 'id' => String,
12
+ 'type' => String,
13
+ 'href' => String,
14
+ 'metadata' => Hash,
15
+ 'properties' => Hash,
16
+ 'entities' => Hash
18
17
  }
19
18
 
20
19
  @minimal_schema_with_items = {
21
- 'id' => String,
22
- 'type' => String,
23
- 'href' => String,
24
- 'items' => Array
20
+ 'id' => String,
21
+ 'type' => String,
22
+ 'href' => String,
23
+ 'items' => Array
25
24
  }
26
25
 
27
26
  service = Fog::Compute[:profitbricks]
28
27
 
29
28
  tests('success') do
30
-
31
29
  Excon.defaults[:connection_timeout] = 200
32
30
 
33
31
  tests('#create_datacenter').data_matches_schema(@resource_schema) do
@@ -39,20 +37,36 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
39
37
  createDatacenterResponse = service.create_datacenter(options)
40
38
  @datacenter_id = createDatacenterResponse.body['id']
41
39
 
42
- if ENV["FOG_MOCK"] != "true"
43
- service.datacenters.get(@datacenter_id).wait_for { ready? }
44
- end
45
-
46
40
  createDatacenterResponse.body
47
41
  end
48
42
 
49
43
  tests('#get_all_images').data_matches_schema(@minimal_schema_with_items) do
50
44
  getAllImagesResponse = service.get_all_images
51
- data = service.get_all_images.body['items'].find { |image|
52
- image['properties']['location'] == 'us/las' &&
53
- image['properties']['imageType'] == 'CDROM' &&
54
- image['properties']['licenceType'] == 'LINUX'
55
- }
45
+
46
+ data = getAllImagesResponse.body['items'].find do |image|
47
+ if ENV["FOG_MOCK"] != "true"
48
+ if image['properties']
49
+ image['properties']['location'] == 'us/las' &&
50
+ image['properties']['imageType'] == 'CDROM' &&
51
+ image['properties']['licenceType'] == 'LINUX'
52
+ else
53
+ image['location'] == 'us/las' &&
54
+ image['imageType'] == 'CDROM' &&
55
+ image['licenceType'] == 'LINUX'
56
+ end
57
+ else
58
+ if image['properties']
59
+ image['properties']['location'] == 'us/las' &&
60
+ image['properties']['imageType'] == 'CDROM' &&
61
+ image['properties']['licenceType'] == 'UNKNOWN'
62
+ else
63
+ image['location'] == 'us/las' &&
64
+ image['imageType'] == 'CDROM' &&
65
+ image['licenceType'] == 'UNKNOWN'
66
+ end
67
+ end
68
+ end
69
+
56
70
  @image_id = data['id']
57
71
  getAllImagesResponse.body
58
72
  end
@@ -66,29 +80,20 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
66
80
  entities = {}
67
81
  entities[:volumes] = {}
68
82
  entities[:volumes]['items'] = [
69
- {
70
- 'properties' => {
71
- 'size' => 5,
72
- 'name' => 'FogTestVolume',
73
- 'licenceType' => 'LINUX',
74
- 'type' => 'HDD'
75
- }
83
+ {
84
+ 'properties' => {
85
+ 'size' => 5,
86
+ 'name' => 'FogTestVolume',
87
+ 'licenceType' => 'LINUX',
88
+ 'type' => 'HDD'
76
89
  }
90
+ }
77
91
  ]
78
92
 
79
93
  createServerResponse = service.create_server(@datacenter_id, properties, entities)
80
94
  @server_id = createServerResponse.body['id']
81
95
 
82
- if ENV["FOG_MOCK"] != "true"
83
- loop do
84
- sleep(120)
85
- server = service.servers.get(@datacenter_id, @server_id)
86
- break unless !server.ready?
87
- end
88
- end
89
-
90
- # Calling wait_for causes ArgumentError
91
- # server.wait_for { ready? }
96
+ sleep(60) if ENV["FOG_MOCK"] != "true"
92
97
 
93
98
  createServerResponse.body
94
99
  end
@@ -106,21 +111,13 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
106
111
  createLanResponse = service.create_lan(@datacenter_id, options)
107
112
  @lan_id = createLanResponse.body['id']
108
113
 
109
- if ENV["FOG_MOCK"] != "true"
110
- loop do
111
- sleep(180)
112
- lan = service.lans.get(@datacenter_id, @lan_id)
113
- break unless !lan.ready?
114
- end
115
-
116
- service.datacenters.get(@datacenter_id).wait_for { ready? }
117
- end
114
+ sleep(60) if ENV["FOG_MOCK"] != "true"
118
115
 
119
116
  createLanResponse.body
120
117
  end
121
118
 
122
119
  tests('#update_lan').data_matches_schema(@extended_resource_schema) do
123
- updateLanResponse = service.update_lan(@datacenter_id, @lan_id, { 'name' => 'FogLan_2_Rename' })
120
+ updateLanResponse = service.update_lan(@datacenter_id, @lan_id, 'name' => 'FogLan_2_Rename')
124
121
  updateLanResponse.body
125
122
  end
126
123
 
@@ -132,6 +129,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
132
129
  options = {}
133
130
  options[:name] = 'FogTestNic_2'
134
131
  options[:lan] = @lan_id
132
+ options[:nat] = false
135
133
 
136
134
  createNicResponse = service.create_nic(@datacenter_id, @server_id, options, {})
137
135
  @nic_id = createNicResponse.body['id']
@@ -140,16 +138,14 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
140
138
  end
141
139
 
142
140
  tests('#get_nic').data_matches_schema(@extended_resource_schema) do
143
- if ENV["FOG_MOCK"] != "true"
144
- sleep(180)
145
- end
141
+ sleep(60) if ENV["FOG_MOCK"] != "true"
146
142
 
147
143
  getNicResponse = service.get_nic(@datacenter_id, @server_id, @nic_id)
148
144
  getNicResponse.body
149
145
  end
150
146
 
151
147
  tests('#update_nic').data_matches_schema(@extended_resource_schema) do
152
- updateNicResponse = service.update_nic(@datacenter_id, @server_id, @nic_id, { 'name' => 'FogTestNic_2_Rename' })
148
+ updateNicResponse = service.update_nic(@datacenter_id, @server_id, @nic_id, 'name' => 'FogTestNic_2_Rename')
153
149
  updateNicResponse.body
154
150
  end
155
151
 
@@ -191,14 +187,12 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
191
187
  end
192
188
 
193
189
  tests('#get_firewall_rule').data_matches_schema(@resource_schema) do
194
- if ENV["FOG_MOCK"] != "true"
195
- sleep(180)
196
- end
190
+ sleep(60) if ENV["FOG_MOCK"] != "true"
197
191
  service.get_firewall_rule(@datacenter_id, @server_id, @nic_id, @firewall_rule_id).body
198
192
  end
199
193
 
200
194
  tests('#update_firewall_rule').data_matches_schema(@resource_schema) do
201
- updateFirewallRuleResponse = service.update_firewall_rule(@datacenter_id, @server_id, @nic_id, @firewall_rule_id, { 'name' => 'Fog test Firewall Rule 2 Rename' })
195
+ updateFirewallRuleResponse = service.update_firewall_rule(@datacenter_id, @server_id, @nic_id, @firewall_rule_id, 'name' => 'Fog test Firewall Rule 2 Rename')
202
196
  updateFirewallRuleResponse.body
203
197
  end
204
198
 
@@ -209,7 +203,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
209
203
 
210
204
  tests('#create_load_balancer').data_matches_schema(@resource_schema) do
211
205
  options = {}
212
- options[:name] = 'FogTestLoadBalancer_2'
206
+ options[:name] = 'FogTestLoadBalancer_2'
213
207
 
214
208
  createLoadBalancerResponse = service.create_load_balancer(@datacenter_id, options, {})
215
209
  @load_balancer_id = createLoadBalancerResponse.body['id']
@@ -217,15 +211,13 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
217
211
  end
218
212
 
219
213
  tests('#get_load_balancer').data_matches_schema(@resource_schema) do
220
- if ENV["FOG_MOCK"] != "true"
221
- sleep(60)
222
- end
214
+ sleep(60) if ENV["FOG_MOCK"] != "true"
223
215
 
224
216
  service.get_load_balancer(@datacenter_id, @load_balancer_id).body
225
217
  end
226
218
 
227
219
  tests('#update_load_balancer').data_matches_schema(@resource_schema) do
228
- updateLoadBalancerResponse = service.update_load_balancer(@datacenter_id, @load_balancer_id, { 'name' => 'FogTestLoadBalancer_2_Rename' })
220
+ updateLoadBalancerResponse = service.update_load_balancer(@datacenter_id, @load_balancer_id, 'name' => 'FogTestLoadBalancer_2_Rename')
229
221
  updateLoadBalancerResponse.body
230
222
  end
231
223
 
@@ -245,9 +237,7 @@ Shindo.tests('Fog::Compute[:profitbricks] | nic request', ['profitbricks', 'comp
245
237
  end
246
238
 
247
239
  tests('#get_load_balanced_nic').succeeds do
248
- if ENV["FOG_MOCK"] != "true"
249
- sleep(60)
250
- end
240
+ sleep(60) if ENV["FOG_MOCK"] != "true"
251
241
  getAllLoadBalancedNicsResponse = service.get_load_balanced_nic(@datacenter_id, @load_balancer_id, @nic_id)
252
242
  getAllLoadBalancedNicsResponse.status == 200
253
243
  end