fog 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +4 -4
  3. data/benchs/fog_vs.rb +8 -37
  4. data/fog.gemspec +6 -12
  5. data/lib/fog.rb +1 -1
  6. data/lib/fog/aws/requests/ec2/delete_key_pair.rb +4 -3
  7. data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
  8. data/lib/fog/aws/s3.rb +8 -4
  9. data/lib/fog/rackspace/models/servers/image.rb +5 -0
  10. data/tests/aws/helper.rb +33 -0
  11. data/tests/aws/requests/ec2/address_tests.rb +40 -47
  12. data/tests/aws/requests/ec2/availability_zone_tests.rb +23 -0
  13. data/tests/aws/requests/ec2/key_pair_tests.rb +44 -0
  14. data/tests/aws/requests/ec2/region_tests.rb +22 -0
  15. data/tests/aws/requests/ec2/security_group_tests.rb +112 -0
  16. data/tests/aws/requests/ec2/snapshot_tests.rb +14 -21
  17. data/tests/aws/requests/ec2/volume_tests.rb +26 -40
  18. data/tests/helper.rb +50 -35
  19. data/tests/rackspace/helper.rb +2 -0
  20. data/tests/rackspace/requests/servers/create_image_tests.rb +11 -13
  21. data/tests/rackspace/requests/servers/create_server_tests.rb +9 -11
  22. data/tests/rackspace/requests/servers/delete_image_tests.rb +9 -15
  23. data/tests/rackspace/requests/servers/delete_server_tests.rb +6 -10
  24. data/tests/rackspace/requests/servers/get_flavor_details_tests.rb +4 -10
  25. data/tests/rackspace/requests/servers/get_image_details_tests.rb +4 -10
  26. data/tests/rackspace/requests/servers/get_server_details_tests.rb +7 -14
  27. data/tests/rackspace/requests/servers/list_addresses_tests.rb +7 -14
  28. data/tests/rackspace/requests/servers/list_flavors_detail_tests.rb +2 -6
  29. data/tests/rackspace/requests/servers/list_flavors_tests.rb +2 -6
  30. data/tests/rackspace/requests/servers/list_images_detail_tests.rb +2 -6
  31. data/tests/rackspace/requests/servers/list_images_tests.rb +2 -6
  32. data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +7 -14
  33. data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +7 -14
  34. data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +5 -10
  35. data/tests/rackspace/requests/servers/list_servers_tests.rb +5 -10
  36. data/tests/rackspace/requests/servers/reboot_server_tests.rb +11 -19
  37. data/tests/rackspace/requests/servers/update_server_tests.rb +7 -14
  38. data/tests/slicehost/requests/create_slice_tests.rb +6 -11
  39. data/tests/slicehost/requests/delete_slice_tests.rb +4 -9
  40. data/tests/slicehost/requests/get_backups_tests.rb +2 -6
  41. data/tests/slicehost/requests/get_flavor_tests.rb +4 -10
  42. data/tests/slicehost/requests/get_flavors_tests.rb +2 -6
  43. data/tests/slicehost/requests/get_image_tests.rb +4 -10
  44. data/tests/slicehost/requests/get_images_tests.rb +2 -6
  45. data/tests/slicehost/requests/get_slice_tests.rb +7 -15
  46. data/tests/slicehost/requests/get_slices_tests.rb +2 -6
  47. data/tests/slicehost/requests/reboot_slice_tests.rb +8 -16
  48. metadata +7 -13
  49. data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +0 -36
  50. data/spec/aws/requests/ec2/create_key_pair_spec.rb +0 -36
  51. data/spec/aws/requests/ec2/create_security_group_spec.rb +0 -34
  52. data/spec/aws/requests/ec2/delete_key_pair_spec.rb +0 -21
  53. data/spec/aws/requests/ec2/delete_security_group_spec.rb +0 -26
  54. data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +0 -23
  55. data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +0 -42
  56. data/spec/aws/requests/ec2/describe_regions_spec.rb +0 -21
  57. data/spec/aws/requests/ec2/describe_security_groups_spec.rb +0 -51
  58. data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +0 -32
@@ -1,19 +1,14 @@
1
1
  Shindo.tests('Slicehost#create_slice', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].create_slice(1, 3, 'fogcreateslice').body
6
- @id = @data['id']
4
+ tests("#create_slice(1, 19, 'fogcreateslice')").formats(Slicehost::Formats::SLICE.merge('root-password' => String)) do
5
+ data = Slicehost[:slices].create_slice(1, 19, 'fogcreateslice').body
6
+ @id = data['id']
7
+ data
7
8
  end
8
9
 
9
- after do
10
- Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
11
- Slicehost[:slices].delete_slice(@id)
12
- end
13
-
14
- test('has proper output format') do
15
- has_format(@data, Slicehost::Formats::SLICE.merge('root-password' => String))
16
- end
10
+ Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
11
+ Slicehost[:slices].delete_slice(@id)
17
12
 
18
13
  end
19
14
  end
@@ -1,12 +1,9 @@
1
1
  Shindo.tests('Slicehost#delete_slice', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].create_slice(1, 3, 'fogdeleteslice').body
6
- @id = @data['id']
7
- end
4
+ @id = Slicehost[:slices].create_slice(1, 19, 'fogdeleteslice').body['id']
8
5
 
9
- test('has proper output format') do
6
+ tests("#delete_slice(#{@id})").succeeds do
10
7
  Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
11
8
  Slicehost[:slices].delete_slice(@id)
12
9
  end
@@ -15,10 +12,8 @@ Shindo.tests('Slicehost#delete_slice', 'slicehost') do
15
12
 
16
13
  tests('failure') do
17
14
 
18
- test('raises NotFound error if slice does not exist') do
19
- has_error(Excon::Errors::NotFound) do
20
- Slicehost[:slices].delete_slice(0)
21
- end
15
+ tests('delete_slice(0)').raises(Excon::Errors::NotFound) do
16
+ Slicehost[:slices].delete_slice(0)
22
17
  end
23
18
 
24
19
  end
@@ -1,12 +1,8 @@
1
1
  Shindo.tests('Slicehost#get_backups', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_backups.body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, { 'backups' => [Slicehost::Formats::BACKUP] })
4
+ tests('#get_backups').formats({ 'backups' => [Slicehost::Formats::BACKUP] }) do
5
+ Slicehost[:slices].get_backups.body
10
6
  end
11
7
 
12
8
  end
@@ -1,22 +1,16 @@
1
1
  Shindo.tests('Slicehost#get_flavor', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_flavor(1).body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, Slicehost::Formats::FLAVOR)
4
+ tests('#get_flavor(1)').formats(Slicehost::Formats::FLAVOR) do
5
+ Slicehost[:slices].get_flavor(1).body
10
6
  end
11
7
 
12
8
  end
13
9
 
14
10
  tests('failure') do
15
11
 
16
- test('raises Forbidden error if flavor does not exist') do
17
- has_error(Excon::Errors::Forbidden) do
18
- Slicehost[:slices].get_flavor(0)
19
- end
12
+ tests('#get_flavor(0)').raises(Excon::Errors::Forbidden) do
13
+ Slicehost[:slices].get_flavor(0)
20
14
  end
21
15
 
22
16
  end
@@ -1,12 +1,8 @@
1
1
  Shindo.tests('Slicehost#get_flavors', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_flavors.body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, { 'flavors' => [Slicehost::Formats::FLAVOR] })
4
+ tests('#get_flavors').formats({ 'flavors' => [Slicehost::Formats::FLAVOR] }) do
5
+ Slicehost[:slices].get_flavors.body
10
6
  end
11
7
 
12
8
  end
@@ -1,22 +1,16 @@
1
1
  Shindo.tests('Slicehost#get_image', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_image(3).body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, Slicehost::Formats::IMAGE)
4
+ tests('#get_image(19)').formats(Slicehost::Formats::IMAGE) do
5
+ Slicehost[:slices].get_image(19).body
10
6
  end
11
7
 
12
8
  end
13
9
 
14
10
  tests('failure') do
15
11
 
16
- test('raises Forbidden error if flavor does not exist') do
17
- has_error(Excon::Errors::Forbidden)
18
- Slicehost[:slices].get_image(0)
19
- end
12
+ tests('#get_image(0)').raises(Excon::Errors::Forbidden) do
13
+ Slicehost[:slices].get_image(0)
20
14
  end
21
15
 
22
16
  end
@@ -1,12 +1,8 @@
1
1
  Shindo.tests('Slicehost#get_images', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_images.body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, { 'images' => [Slicehost::Formats::IMAGE] })
4
+ tests('#get_images').formats({ 'images' => [Slicehost::Formats::IMAGE] }) do
5
+ Slicehost[:slices].get_images.body
10
6
  end
11
7
 
12
8
  end
@@ -1,29 +1,21 @@
1
1
  Shindo.tests('Slicehost#get_slice', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].create_slice(1, 3, 'foggetslice').body
6
- @id = @data['id']
7
- @data = Slicehost[:slices].get_slice(@id).body
8
- end
4
+ @server = Slicehost[:slices].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogrebootslice')
9
5
 
10
- after do
11
- Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
12
- Slicehost[:slices].delete_slice(@id)
6
+ tests("#get_slice(#{@server.id})").formats(Slicehost::Formats::SLICE) do
7
+ Slicehost[:slices].get_slice(@server.id).body
13
8
  end
14
9
 
15
- test('has proper output format') do
16
- has_format(@data, Slicehost::Formats::SLICE)
17
- end
10
+ @server.wait_for { ready? }
11
+ @server.destroy
18
12
 
19
13
  end
20
14
 
21
15
  tests('failure') do
22
16
 
23
- test('raises Forbidden error if flavor does not exist') do
24
- has_error(Excon::Errors::Forbidden)
25
- Slicehost[:slices].get_slice(0)
26
- end
17
+ tests('#get_slice(0)').raises(Excon::Errors::Forbidden) do
18
+ Slicehost[:slices].get_slice(0)
27
19
  end
28
20
 
29
21
  end
@@ -1,12 +1,8 @@
1
1
  Shindo.tests('Slicehost#get_slices', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].get_slices.body
6
- end
7
-
8
- test('has proper output format') do
9
- has_format(@data, { 'slices' => [Slicehost::Formats::SLICE] })
4
+ formats({'slices' => [Slicehost::Formats::SLICE]}) do
5
+ Slicehost[:slices].get_slices.body
10
6
  end
11
7
 
12
8
  end
@@ -1,30 +1,22 @@
1
1
  Shindo.tests('Slicehost#reboot_slice', 'slicehost') do
2
2
  tests('success') do
3
3
 
4
- before do
5
- @data = Slicehost[:slices].create_slice(1, 3, 'fogrebootslice').body
6
- @id = @data['id']
7
- Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
8
- @data = Slicehost[:slices].reboot_slice(@id).body
9
- end
4
+ @server = Slicehost[:slices].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogrebootslice')
5
+ @server.wait_for { ready? }
10
6
 
11
- after do
12
- Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
13
- Slicehost[:slices].delete_slice(@id)
7
+ tests("#reboot_slice(#{@server.id})").formats(Slicehost::Formats::SLICE) do
8
+ Slicehost[:slices].reboot_slice(@server.id).body
14
9
  end
15
10
 
16
- test('has proper output format') do
17
- has_format(@data, Slicehost::Formats::SLICE)
18
- end
11
+ @server.wait_for { ready? }
12
+ @server.destroy
19
13
 
20
14
  end
21
15
 
22
16
  tests('failure') do
23
17
 
24
- test('raises Forbidden error if flavor does not exist') do
25
- has_error(Excon::Errors::Forbidden) do
26
- Slicehost[:slices].reboot_slice(0)
27
- end
18
+ tests('#reboot_slice(0)').raises(Excon::Errors::Forbidden) do
19
+ Slicehost[:slices].reboot_slice(0)
28
20
  end
29
21
 
30
22
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-18 00:00:00 -07:00
17
+ date: 2010-05-23 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -466,20 +466,10 @@ files:
466
466
  - spec/aws/models/s3/directory_spec.rb
467
467
  - spec/aws/models/s3/file_spec.rb
468
468
  - spec/aws/models/s3/files_spec.rb
469
- - spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb
470
- - spec/aws/requests/ec2/create_key_pair_spec.rb
471
- - spec/aws/requests/ec2/create_security_group_spec.rb
472
- - spec/aws/requests/ec2/delete_key_pair_spec.rb
473
- - spec/aws/requests/ec2/delete_security_group_spec.rb
474
- - spec/aws/requests/ec2/describe_availability_zones_spec.rb
475
469
  - spec/aws/requests/ec2/describe_images_spec.rb
476
470
  - spec/aws/requests/ec2/describe_instances_spec.rb
477
- - spec/aws/requests/ec2/describe_key_pairs_spec.rb
478
- - spec/aws/requests/ec2/describe_regions_spec.rb
479
- - spec/aws/requests/ec2/describe_security_groups_spec.rb
480
471
  - spec/aws/requests/ec2/get_console_output_spec.rb
481
472
  - spec/aws/requests/ec2/reboot_instances_spec.rb
482
- - spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb
483
473
  - spec/aws/requests/ec2/run_instances_spec.rb
484
474
  - spec/aws/requests/ec2/terminate_instances_spec.rb
485
475
  - spec/aws/requests/s3/copy_object_spec.rb
@@ -537,6 +527,10 @@ files:
537
527
  - spec/vcloud/vcloud_spec.rb
538
528
  - tests/aws/helper.rb
539
529
  - tests/aws/requests/ec2/address_tests.rb
530
+ - tests/aws/requests/ec2/availability_zone_tests.rb
531
+ - tests/aws/requests/ec2/key_pair_tests.rb
532
+ - tests/aws/requests/ec2/region_tests.rb
533
+ - tests/aws/requests/ec2/security_group_tests.rb
540
534
  - tests/aws/requests/ec2/snapshot_tests.rb
541
535
  - tests/aws/requests/ec2/volume_tests.rb
542
536
  - tests/helper.rb
@@ -1,36 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'EC2.authorize_security_group_ingress' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
8
- end
9
-
10
- after(:each) do
11
- AWS[:ec2].delete_security_group('fog_security_group')
12
- end
13
-
14
- it "should return proper attributes for port based ingress" do
15
- actual = AWS[:ec2].authorize_security_group_ingress({
16
- 'FromPort' => 80,
17
- 'GroupName' => 'fog_security_group',
18
- 'IpProtocol' => 'tcp',
19
- 'ToPort' => 80,
20
- })
21
- actual.body['requestId'].should be_a(String)
22
- [false, true].should include(actual.body['return'])
23
- end
24
-
25
- it "should return proper attributes for named ingress" do
26
- actual = AWS[:ec2].authorize_security_group_ingress({
27
- 'GroupName' => 'fog_security_group',
28
- 'SourceSecurityGroupName' => 'fog_security_group',
29
- 'SourceSecurityGroupOwnerId' => '254056571511'
30
- })
31
- actual.body['requestId'].should be_a(String)
32
- [false, true].should include(actual.body['return'])
33
- end
34
-
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'EC2.create_key_pair' do
4
- describe 'success' do
5
-
6
- after(:each) do
7
- AWS[:ec2].delete_key_pair('fog_key_pair')
8
- end
9
-
10
- it "should return proper attributes" do
11
- actual = AWS[:ec2].create_key_pair('fog_key_pair')
12
- actual.body['keyFingerprint'].should be_a(String)
13
- actual.body['keyMaterial'].should be_a(String)
14
- actual.body['keyName'].should be_a(String)
15
- actual.body['requestId'].should be_a(String)
16
- end
17
-
18
- end
19
- describe 'failure' do
20
-
21
- before(:each) do
22
- AWS[:ec2].create_key_pair('fog_key_pair')
23
- end
24
-
25
- after(:each) do
26
- AWS[:ec2].delete_key_pair('fog_key_pair')
27
- end
28
-
29
- it "should raise a BadRequest when the key pair already exists" do
30
- lambda {
31
- AWS[:ec2].create_key_pair('fog_key_pair')
32
- }.should raise_error(Excon::Errors::BadRequest)
33
- end
34
-
35
- end
36
- end
@@ -1,34 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'EC2.create_security_group' do
4
- describe 'success' do
5
-
6
- after(:each) do
7
- AWS[:ec2].delete_security_group('fog_security_group')
8
- end
9
-
10
- it "should return proper attributes" do
11
- actual = AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
12
- actual.body['requestId'].should be_a(String)
13
- [false, true].should include(actual.body['return'])
14
- end
15
-
16
- end
17
- describe 'failure' do
18
-
19
- before(:each) do
20
- AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
21
- end
22
-
23
- after(:each) do
24
- AWS[:ec2].delete_security_group('fog_security_group')
25
- end
26
-
27
- it "should raise a BadRequest error when the security group already exists" do
28
- lambda {
29
- AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
30
- }.should raise_error(Excon::Errors::BadRequest)
31
- end
32
-
33
- end
34
- end
@@ -1,21 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'EC2.delete_key_pair' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- AWS[:ec2].create_key_pair('fog_key_name')
8
- @response = AWS[:ec2].delete_key_pair('fog_key_name')
9
- end
10
-
11
- it "should return proper attributes" do
12
- @response.body['requestId'].should be_a(String)
13
- [false, true].should include(@response.body['return'])
14
- end
15
-
16
- it "should not raise an error if the key pair does not exist" do
17
- AWS[:ec2].delete_key_pair('not_a_key_name')
18
- end
19
-
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'EC2.delete_security_group' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
8
- end
9
-
10
- it "should return proper attributes" do
11
- actual = AWS[:ec2].delete_security_group('fog_security_group')
12
- actual.body['requestId'].should be_a(String)
13
- [false, true].should include(actual.body['return'])
14
- end
15
-
16
- end
17
- describe 'failure' do
18
-
19
- it "should raise a BadRequest error if the security group does not exist" do
20
- lambda {
21
- AWS[:ec2].delete_security_group('fog_not_a_security_group')
22
- }.should raise_error(Excon::Errors::BadRequest)
23
- end
24
-
25
- end
26
- end