fog 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -4
- data/benchs/fog_vs.rb +8 -37
- data/fog.gemspec +6 -12
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +4 -3
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
- data/lib/fog/aws/s3.rb +8 -4
- data/lib/fog/rackspace/models/servers/image.rb +5 -0
- data/tests/aws/helper.rb +33 -0
- data/tests/aws/requests/ec2/address_tests.rb +40 -47
- data/tests/aws/requests/ec2/availability_zone_tests.rb +23 -0
- data/tests/aws/requests/ec2/key_pair_tests.rb +44 -0
- data/tests/aws/requests/ec2/region_tests.rb +22 -0
- data/tests/aws/requests/ec2/security_group_tests.rb +112 -0
- data/tests/aws/requests/ec2/snapshot_tests.rb +14 -21
- data/tests/aws/requests/ec2/volume_tests.rb +26 -40
- data/tests/helper.rb +50 -35
- data/tests/rackspace/helper.rb +2 -0
- data/tests/rackspace/requests/servers/create_image_tests.rb +11 -13
- data/tests/rackspace/requests/servers/create_server_tests.rb +9 -11
- data/tests/rackspace/requests/servers/delete_image_tests.rb +9 -15
- data/tests/rackspace/requests/servers/delete_server_tests.rb +6 -10
- data/tests/rackspace/requests/servers/get_flavor_details_tests.rb +4 -10
- data/tests/rackspace/requests/servers/get_image_details_tests.rb +4 -10
- data/tests/rackspace/requests/servers/get_server_details_tests.rb +7 -14
- data/tests/rackspace/requests/servers/list_addresses_tests.rb +7 -14
- data/tests/rackspace/requests/servers/list_flavors_detail_tests.rb +2 -6
- data/tests/rackspace/requests/servers/list_flavors_tests.rb +2 -6
- data/tests/rackspace/requests/servers/list_images_detail_tests.rb +2 -6
- data/tests/rackspace/requests/servers/list_images_tests.rb +2 -6
- data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +7 -14
- data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +7 -14
- data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +5 -10
- data/tests/rackspace/requests/servers/list_servers_tests.rb +5 -10
- data/tests/rackspace/requests/servers/reboot_server_tests.rb +11 -19
- data/tests/rackspace/requests/servers/update_server_tests.rb +7 -14
- data/tests/slicehost/requests/create_slice_tests.rb +6 -11
- data/tests/slicehost/requests/delete_slice_tests.rb +4 -9
- data/tests/slicehost/requests/get_backups_tests.rb +2 -6
- data/tests/slicehost/requests/get_flavor_tests.rb +4 -10
- data/tests/slicehost/requests/get_flavors_tests.rb +2 -6
- data/tests/slicehost/requests/get_image_tests.rb +4 -10
- data/tests/slicehost/requests/get_images_tests.rb +2 -6
- data/tests/slicehost/requests/get_slice_tests.rb +7 -15
- data/tests/slicehost/requests/get_slices_tests.rb +2 -6
- data/tests/slicehost/requests/reboot_slice_tests.rb +8 -16
- metadata +7 -13
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +0 -36
- data/spec/aws/requests/ec2/create_key_pair_spec.rb +0 -36
- data/spec/aws/requests/ec2/create_security_group_spec.rb +0 -34
- data/spec/aws/requests/ec2/delete_key_pair_spec.rb +0 -21
- data/spec/aws/requests/ec2/delete_security_group_spec.rb +0 -26
- data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +0 -23
- data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +0 -42
- data/spec/aws/requests/ec2/describe_regions_spec.rb +0 -21
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +0 -51
- data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +0 -32
@@ -0,0 +1,22 @@
|
|
1
|
+
Shindo.tests('AWS::EC2 | region requests', ['aws']) do
|
2
|
+
|
3
|
+
tests('success') do
|
4
|
+
|
5
|
+
tests("#describe_regions").formats(AWS::EC2::Formats::REGIONS) do
|
6
|
+
AWS[:ec2].describe_regions.body
|
7
|
+
end
|
8
|
+
|
9
|
+
tests("#describe_regions('us-east-1')").formats(AWS::EC2::Formats::REGIONS) do
|
10
|
+
AWS[:ec2].describe_regions('us-east-1').body
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
tests('failure') do
|
16
|
+
|
17
|
+
tests("#describe_regions('not-a-region')").raises(Excon::Errors::BadRequest) do
|
18
|
+
AWS[:ec2].describe_regions('not-a-region')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
2
|
+
|
3
|
+
@owner_id = AWS[:ec2].describe_security_groups('default').body['securityGroupInfo'].first['ownerId']
|
4
|
+
|
5
|
+
tests('success') do
|
6
|
+
|
7
|
+
tests("#create_security_group('fog_security_group', 'tests group')").formats(AWS::EC2::Formats::BASIC) do
|
8
|
+
AWS[:ec2].create_security_group('fog_security_group', 'tests group').body
|
9
|
+
end
|
10
|
+
|
11
|
+
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'fog_security_group', 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::EC2::Formats::BASIC) do
|
12
|
+
AWS[:ec2].authorize_security_group_ingress({
|
13
|
+
'FromPort' => 80,
|
14
|
+
'GroupName' => 'fog_security_group',
|
15
|
+
'IpProtocol' => 'tcp',
|
16
|
+
'ToPort' => 80,
|
17
|
+
}).body
|
18
|
+
end
|
19
|
+
|
20
|
+
tests("#authorize_security_group_ingress({'GroupName' => 'fog_security_group', 'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::EC2::Formats::BASIC) do
|
21
|
+
AWS[:ec2].authorize_security_group_ingress({
|
22
|
+
'GroupName' => 'fog_security_group',
|
23
|
+
'SourceSecurityGroupName' => 'fog_security_group',
|
24
|
+
'SourceSecurityGroupOwnerId' => @owner_id
|
25
|
+
}).body
|
26
|
+
end
|
27
|
+
|
28
|
+
tests("#describe_security_groups").formats(AWS::EC2::Formats::SECURITY_GROUPS) do
|
29
|
+
AWS[:ec2].describe_security_groups.body
|
30
|
+
end
|
31
|
+
|
32
|
+
tests("#describe_security_groups('fog_security_group')").formats(AWS::EC2::Formats::SECURITY_GROUPS) do
|
33
|
+
AWS[:ec2].describe_security_groups('fog_security_group').body
|
34
|
+
end
|
35
|
+
|
36
|
+
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'fog_security_group', 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::EC2::Formats::BASIC) do
|
37
|
+
AWS[:ec2].revoke_security_group_ingress({
|
38
|
+
'FromPort' => 80,
|
39
|
+
'GroupName' => 'fog_security_group',
|
40
|
+
'IpProtocol' => 'tcp',
|
41
|
+
'ToPort' => 80,
|
42
|
+
}).body
|
43
|
+
end
|
44
|
+
|
45
|
+
tests("#revoke_security_group_ingress({'GroupName' => 'fog_security_group', 'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::EC2::Formats::BASIC) do
|
46
|
+
AWS[:ec2].revoke_security_group_ingress({
|
47
|
+
'GroupName' => 'fog_security_group',
|
48
|
+
'SourceSecurityGroupName' => 'fog_security_group',
|
49
|
+
'SourceSecurityGroupOwnerId' => @owner_id
|
50
|
+
}).body
|
51
|
+
end
|
52
|
+
|
53
|
+
tests("#delete_security_group('fog_security_group')").formats(AWS::EC2::Formats::BASIC) do
|
54
|
+
AWS[:ec2].delete_security_group('fog_security_group').body
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
tests('failure') do
|
59
|
+
|
60
|
+
@security_group = AWS[:ec2].security_groups.create(:description => 'tests group', :name => 'fog_security_group')
|
61
|
+
|
62
|
+
tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Excon::Errors::BadRequest) do
|
63
|
+
AWS[:ec2].create_security_group(@security_group.name, @security_group.description)
|
64
|
+
end
|
65
|
+
|
66
|
+
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Excon::Errors::BadRequest) do
|
67
|
+
AWS[:ec2].authorize_security_group_ingress({
|
68
|
+
'FromPort' => 80,
|
69
|
+
'GroupName' => 'not_a_group_name',
|
70
|
+
'IpProtocol' => 'tcp',
|
71
|
+
'ToPort' => 80,
|
72
|
+
})
|
73
|
+
end
|
74
|
+
|
75
|
+
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Excon::Errors::BadRequest) do
|
76
|
+
AWS[:ec2].authorize_security_group_ingress({
|
77
|
+
'GroupName' => 'not_a_group_name',
|
78
|
+
'SourceSecurityGroupName' => 'not_a_group_name',
|
79
|
+
'SourceSecurityGroupOwnerId' => @owner_id
|
80
|
+
})
|
81
|
+
end
|
82
|
+
|
83
|
+
tests("#describe_security_group('not_a_group_name)").raises(Excon::Errors::BadRequest) do
|
84
|
+
AWS[:ec2].describe_security_groups('not_a_group_name')
|
85
|
+
end
|
86
|
+
|
87
|
+
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Excon::Errors::BadRequest) do
|
88
|
+
AWS[:ec2].revoke_security_group_ingress({
|
89
|
+
'FromPort' => 80,
|
90
|
+
'GroupName' => 'not_a_group_name',
|
91
|
+
'IpProtocol' => 'tcp',
|
92
|
+
'ToPort' => 80,
|
93
|
+
})
|
94
|
+
end
|
95
|
+
|
96
|
+
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Excon::Errors::BadRequest) do
|
97
|
+
AWS[:ec2].revoke_security_group_ingress({
|
98
|
+
'GroupName' => 'not_a_group_name',
|
99
|
+
'SourceSecurityGroupName' => 'not_a_group_name',
|
100
|
+
'SourceSecurityGroupOwnerId' => @owner_id
|
101
|
+
})
|
102
|
+
end
|
103
|
+
|
104
|
+
tests("#delete_security_group('not_a_group_name')").raises(Excon::Errors::BadRequest) do
|
105
|
+
AWS[:ec2].delete_security_group('not_a_group_name')
|
106
|
+
end
|
107
|
+
|
108
|
+
@security_group.destroy
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -6,41 +6,34 @@ Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
|
|
6
6
|
|
7
7
|
@snapshot_id = nil
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
@snapshot_id =
|
12
|
-
|
9
|
+
tests("#create_snapshot(#{@volume.identity})").formats(AWS::EC2::Formats::SNAPSHOT.merge('progress' => NilClass, 'requestId' => String)) do
|
10
|
+
data = AWS[:ec2].create_snapshot(@volume.identity).body
|
11
|
+
@snapshot_id = data['snapshotId']
|
12
|
+
data
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
tests("#describe_snapshots").formats(AWS::EC2::Formats::SNAPSHOTS) do
|
16
16
|
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
17
|
-
|
18
|
-
has_format(@data, AWS::EC2::Formats::SNAPSHOTS)
|
17
|
+
AWS[:ec2].describe_snapshots.body
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
has_format(@data, AWS::EC2::Formats::SNAPSHOTS)
|
20
|
+
tests("#describe_snapshots('#{@snapshot_id}')").formats(AWS::EC2::Formats::SNAPSHOTS) do
|
21
|
+
AWS[:ec2].describe_snapshots(@snapshot_id).body
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
has_format(@data, AWS::EC2::Formats::BASIC)
|
24
|
+
tests("#delete_snapshots(#{@snapshot_id})").formats(AWS::EC2::Formats::BASIC) do
|
25
|
+
AWS[:ec2].delete_snapshot(@snapshot_id).body
|
29
26
|
end
|
30
27
|
|
31
28
|
end
|
32
29
|
tests ('failure') do
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
AWS[:ec2].describe_snapshots('snap-00000000')
|
37
|
-
end
|
31
|
+
tests("#describe_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
32
|
+
AWS[:ec2].describe_snapshots('snap-00000000')
|
38
33
|
end
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
AWS[:ec2].delete_snapshot('snap-00000000')
|
43
|
-
end
|
35
|
+
tests("#delete_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
36
|
+
AWS[:ec2].delete_snapshot('snap-00000000')
|
44
37
|
end
|
45
38
|
|
46
39
|
end
|
@@ -7,37 +7,33 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|
7
7
|
|
8
8
|
@volume_id = nil
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
@volume_id =
|
13
|
-
|
10
|
+
tests('#create_volume').formats(AWS::EC2::Formats::VOLUME) do
|
11
|
+
data = AWS[:ec2].create_volume(@server.availability_zone, 1).body
|
12
|
+
@volume_id = data['volumeId']
|
13
|
+
data
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
has_format(@data, AWS::EC2::Formats::VOLUMES)
|
16
|
+
tests('#describe_volumes').formats(AWS::EC2::Formats::VOLUMES) do
|
17
|
+
AWS[:ec2].describe_volumes.body
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
has_format(@data, AWS::EC2::Formats::VOLUMES)
|
20
|
+
tests("#describe_volumes(#{@volume_id})").formats(AWS::EC2::Formats::VOLUMES) do
|
21
|
+
AWS[:ec2].describe_volumes.body
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
tests("#attach_volume(#{@server.identity}, #{@volume_id}, '/dev/sdh')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
|
25
|
+
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
26
|
+
AWS[:ec2].attach_volume(@server.identity, @volume_id, '/dev/sdh').body
|
29
27
|
end
|
30
28
|
|
31
|
-
|
32
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { state == '
|
33
|
-
|
34
|
-
has_format(@data, AWS::EC2::Formats::VOLUME_ATTACHMENT)
|
29
|
+
tests("#detach_volume('#{@volume_id}')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
|
30
|
+
AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'in-use' }
|
31
|
+
AWS[:ec2].detach_volume(@volume_id).body
|
35
32
|
end
|
36
33
|
|
37
|
-
|
34
|
+
tests("#delete_volume('#{@volume_id}')").formats(AWS::EC2::Formats::BASIC) do
|
38
35
|
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
39
|
-
|
40
|
-
has_format(@data, AWS::EC2::Formats::BASIC)
|
36
|
+
AWS[:ec2].delete_volume(@volume_id).body
|
41
37
|
end
|
42
38
|
|
43
39
|
end
|
@@ -45,34 +41,24 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|
45
41
|
|
46
42
|
@volume = AWS[:ec2].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
|
47
43
|
|
48
|
-
|
49
|
-
|
50
|
-
AWS[:ec2].describe_volumes('vol-00000000')
|
51
|
-
end
|
44
|
+
tests("#describe_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
45
|
+
AWS[:ec2].describe_volumes('vol-00000000')
|
52
46
|
end
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
57
|
-
end
|
48
|
+
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
49
|
+
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
58
50
|
end
|
59
51
|
|
60
|
-
|
61
|
-
|
62
|
-
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
63
|
-
end
|
52
|
+
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
53
|
+
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
64
54
|
end
|
65
55
|
|
66
|
-
|
67
|
-
|
68
|
-
AWS[:ec2].detach_volume('vol-00000000')
|
69
|
-
end
|
56
|
+
tests("#detach_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
57
|
+
AWS[:ec2].detach_volume('vol-00000000')
|
70
58
|
end
|
71
59
|
|
72
|
-
|
73
|
-
|
74
|
-
AWS[:ec2].delete_volume('vol-00000000')
|
75
|
-
end
|
60
|
+
tests("#delete_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
61
|
+
AWS[:ec2].delete_volume('vol-00000000')
|
76
62
|
end
|
77
63
|
|
78
64
|
@volume.destroy
|
data/tests/helper.rb
CHANGED
@@ -5,45 +5,60 @@ if ENV["FOG_MOCK"] == "true"
|
|
5
5
|
Fog.mock!
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
yield
|
11
|
-
@formatador.display_line("[red]did not raise #{error}[/]")
|
12
|
-
false
|
13
|
-
rescue error
|
14
|
-
true
|
15
|
-
end
|
16
|
-
end
|
8
|
+
module Shindo
|
9
|
+
class Tests
|
17
10
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
def formats(format, &block)
|
12
|
+
test('has proper format') do
|
13
|
+
formats_kernel(instance_eval(&block), format)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def succeeds(&block)
|
18
|
+
test('succeeds') do
|
19
|
+
begin
|
20
|
+
instance_eval(&block)
|
21
|
+
true
|
22
|
+
rescue Exception, Interrupt
|
23
|
+
false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def formats_kernel(original_data, original_format, original = true)
|
31
|
+
valid = true
|
32
|
+
data = original_data.dup
|
33
|
+
format = original_format.dup
|
34
|
+
for key, value in format
|
35
|
+
valid &&= data.has_key?(key)
|
36
|
+
datum = data.delete(key)
|
37
|
+
format.delete(key)
|
38
|
+
case value
|
39
|
+
when Array
|
40
|
+
valid &&= datum.is_a?(Array)
|
41
|
+
for element in datum
|
42
|
+
type = value.first
|
43
|
+
if type.is_a?(Hash)
|
44
|
+
valid &&= formats_kernel({:element => element}, {:element => type}, false)
|
45
|
+
else
|
46
|
+
valid &&= element.is_a?(type)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
when Hash
|
50
|
+
valid &&= datum.is_a?(Hash)
|
51
|
+
valid &&= formats_kernel(datum, value, false)
|
33
52
|
else
|
34
|
-
valid &&=
|
53
|
+
valid &&= datum.is_a?(value)
|
35
54
|
end
|
36
55
|
end
|
37
|
-
|
38
|
-
valid
|
39
|
-
|
40
|
-
|
41
|
-
valid
|
56
|
+
valid &&= data.empty? && format.empty?
|
57
|
+
if !valid && original
|
58
|
+
@message = "#{original_data.inspect} does not match #{original_format.inspect}"
|
59
|
+
end
|
60
|
+
valid
|
42
61
|
end
|
62
|
+
|
43
63
|
end
|
44
|
-
valid &&= data.empty? && format.empty?
|
45
|
-
unless valid
|
46
|
-
@formatador.display_line("[red]#{original_data.inspect} does not match #{original_format.inspect}[/]")
|
47
|
-
end
|
48
|
-
valid
|
49
64
|
end
|
data/tests/rackspace/helper.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
Shindo.tests('Rackspace::Servers#create_image', 'rackspace') do
|
2
2
|
tests('success') do
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@data = Rackspace[:servers].create_image(@server_id).body['image']
|
8
|
-
@image_id = @data['id']
|
9
|
-
end
|
4
|
+
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foggetserverdetails')
|
5
|
+
@server.wait_for { ready? }
|
6
|
+
@image_id = nil
|
10
7
|
|
11
|
-
|
12
|
-
Rackspace[:servers].
|
13
|
-
|
14
|
-
|
8
|
+
tests("#create_image(#{@server.id})").formats(Rackspace::Servers::Formats::IMAGE.reject {|key,value| key == 'progress'}) do
|
9
|
+
data = Rackspace[:servers].create_image(@server.id).body['image']
|
10
|
+
@image_id = data['id']
|
11
|
+
data
|
15
12
|
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
@image = Rackspace[:servers].images.get(@image_id)
|
15
|
+
@image.wait_for { ready? }
|
16
|
+
@image.destroy
|
17
|
+
@server.destroy
|
20
18
|
|
21
19
|
end
|
22
20
|
end
|
@@ -1,20 +1,18 @@
|
|
1
1
|
Shindo.tests('Rackspace::Servers#create_server', 'rackspace') do
|
2
2
|
tests('success') do
|
3
3
|
|
4
|
-
|
5
|
-
# 1 => 256MB, 3 => Gentoo
|
6
|
-
@data = Rackspace[:servers].create_server(1, 3).body['server']
|
7
|
-
@server_id = @data['id']
|
8
|
-
end
|
4
|
+
@server_id = nil
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
Rackspace[:servers].
|
6
|
+
tests('#create_server(1, 19)').formats(Rackspace::Servers::Formats::SERVER.merge('adminPass' => String)) do
|
7
|
+
# 1 => 256MB, 19 => Gentoo
|
8
|
+
data = Rackspace[:servers].create_server(1, 19).body['server']
|
9
|
+
@server_id = data['id']
|
10
|
+
data
|
13
11
|
end
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
@server = Rackspace[:servers].servers.get(@server_id)
|
14
|
+
@server.wait_for { ready? }
|
15
|
+
@server.destroy
|
18
16
|
|
19
17
|
end
|
20
18
|
end
|