/
server_tests.rb
57 lines (44 loc) · 1.59 KB
/
server_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
Shindo.tests('Voxel::Compute | server requests', ['voxel']) do
@server_format = {
:id => Integer,
:name => String,
:processing_cores => Integer,
:image_id => Integer,
:facility => String,
:disk_size => Integer,
:addresses => {
:private => String,
:public => String
},
:password => String
}
tests('success') do
@server_id = nil
tests('#voxcloud_create( :name => "fog.test", :disk_size => 10, :processing_cores => 1, :image_id => 16, :facility => "LDJ1" )').formats([@server_format]) do
data = Voxel[:compute].voxcloud_create( :name => "fog.test", :disk_size => 10, :processing_cores => 1, :image_id => 16, :facility => "LDJ1" )
@server_id = data.first[:id]
data
end
Voxel[:compute].servers.get(@server_id).wait_for { ready? }
tests('#devices_list').formats([ @server_format ]) do
Voxel[:compute].devices_list
end
tests('#devices_list(@server_id)').formats([ @server_format ]) do
Voxel[:compute].devices_list(@server_id)
end
tests("#voxcloud_delete(#{@server_id})").succeeds do
Voxel[:compute].voxcloud_delete(@server_id)
end
end
tests('failure') do
tests('#voxcloud_delete(0)').raises(Fog::Voxel::Compute::NotFound) do
Voxel[:compute].voxcloud_delete(0)
end
tests('#voxcloud_status(0)').raises(Fog::Voxel::Compute::NotFound) do
Voxel[:compute].voxcloud_status(0)
end
tests('#devices_list(0)').raises(Fog::Voxel::Compute::NotFound) do
Voxel[:compute].devices_list(0)
end
end
end