/
cloud_ip_tests.rb
71 lines (53 loc) · 2.09 KB
/
cloud_ip_tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
tests('success') do
unless Fog.mocking?
@server = Fog::Compute[:brightbox].servers.create(compute_providers[:brightbox][:server_attributes])
end
tests("#create_cloud_ip").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_cloud_ip
@cloud_ip_id = data["id"]
data
end
tests("#list_cloud_ips").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do
pending if Fog.mocking?
Fog::Compute[:brightbox].list_cloud_ips
end
tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking?
Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id)
end
unless Fog.mocking?
@server.wait_for { ready? }
map_options = {:interface => @server.interfaces.first["id"]}
end
tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking?
Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
end
unless Fog.mocking?
Fog::Compute[:brightbox].cloud_ips.get(@cloud_ip_id).wait_for { mapped? }
end
tests("#unmap_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking?
Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
end
tests("#destroy_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
end
unless Fog.mocking?
@server.destroy
end
end
tests('failure') do
tests("#get_cloud_ip('cip-00000')").raises(Excon::Errors::NotFound) do
pending if Fog.mocking?
Fog::Compute[:brightbox].get_cloud_ip('cip-00000')
end
tests("#get_cloud_ip").raises(ArgumentError) do
pending if Fog.mocking?
Fog::Compute[:brightbox].get_cloud_ip
end
end
end