fog-google 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CONTRIBUTING.md +66 -1
  4. data/CONTRIBUTORS.md +1 -0
  5. data/README.md +24 -7
  6. data/Rakefile +14 -5
  7. data/examples/image_create.rb +1 -1
  8. data/examples/launch_micro_instance.rb +1 -1
  9. data/lib/fog/google/compute.rb +6 -2
  10. data/lib/fog/google/models/compute/addresses.rb +13 -0
  11. data/lib/fog/google/models/compute/backend_services.rb +3 -4
  12. data/lib/fog/google/models/compute/global_forwarding_rules.rb +5 -3
  13. data/lib/fog/google/models/compute/images.rb +8 -2
  14. data/lib/fog/google/models/compute/resource_views.rb +2 -2
  15. data/lib/fog/google/models/compute/server.rb +37 -3
  16. data/lib/fog/google/models/compute/target_http_proxies.rb +5 -2
  17. data/lib/fog/google/models/compute/target_http_proxy.rb +1 -1
  18. data/lib/fog/google/models/compute/target_instance.rb +2 -2
  19. data/lib/fog/google/models/compute/target_instances.rb +21 -8
  20. data/lib/fog/google/models/compute/url_map.rb +1 -1
  21. data/lib/fog/google/models/compute/url_maps.rb +5 -2
  22. data/lib/fog/google/requests/compute/insert_target_instance.rb +1 -1
  23. data/lib/fog/google/requests/compute/list_aggregated_target_instances.rb +42 -0
  24. data/lib/fog/google/version.rb +1 -1
  25. data/test/helpers/integration_test_helper.rb +22 -0
  26. data/test/helpers/test_collection.rb +37 -0
  27. data/test/helpers/test_helper.rb +19 -0
  28. data/test/integration/compute/test_backend_services.rb +11 -0
  29. data/test/integration/compute/test_disk_types.rb +39 -0
  30. data/test/integration/compute/test_disks.rb +11 -0
  31. data/test/integration/compute/test_forwarding_rules.rb +11 -0
  32. data/test/integration/compute/test_global_forwarding_rules.rb +11 -0
  33. data/test/integration/compute/test_http_health_checks.rb +11 -0
  34. data/test/integration/compute/test_images.rb +11 -0
  35. data/test/integration/compute/test_regions.rb +33 -0
  36. data/test/integration/compute/test_servers.rb +28 -0
  37. data/test/integration/compute/test_target_http_proxies.rb +11 -0
  38. data/test/integration/compute/test_target_instances.rb +11 -0
  39. data/test/integration/compute/test_target_pools.rb +11 -0
  40. data/test/integration/compute/test_url_maps.rb +11 -0
  41. data/test/integration/factories/backend_services_factory.rb +19 -0
  42. data/test/integration/factories/collection_factory.rb +27 -0
  43. data/test/integration/factories/disks_factory.rb +13 -0
  44. data/test/integration/factories/forwarding_rules_factory.rb +21 -0
  45. data/test/integration/factories/global_forwarding_rules_factory.rb +19 -0
  46. data/test/integration/factories/http_health_checks_factory.rb +11 -0
  47. data/test/integration/factories/images_factory.rb +12 -0
  48. data/test/integration/factories/servers_factory.rb +21 -0
  49. data/test/integration/factories/target_http_proxies_factory.rb +19 -0
  50. data/test/integration/factories/target_instances_factory.rb +20 -0
  51. data/test/integration/factories/target_pools_factory.rb +24 -0
  52. data/test/integration/factories/url_maps_factory.rb +19 -0
  53. data/test/integration/test_authentication.rb +59 -0
  54. data/tests/helpers/collection_helper.rb +2 -0
  55. data/tests/helpers/model_helper.rb +2 -0
  56. metadata +61 -31
  57. data/.ruby-version +0 -1
  58. data/spec/minitest_helper.rb +0 -15
  59. data/tests/credentials_tests.rb +0 -73
  60. data/tests/models/compute/backend_service_tests.rb +0 -7
  61. data/tests/models/compute/backend_services_tests.rb +0 -8
  62. data/tests/models/compute/disk_tests.rb +0 -9
  63. data/tests/models/compute/disk_types_tests.rb +0 -22
  64. data/tests/models/compute/disks_tests.rb +0 -9
  65. data/tests/models/compute/forwarding_rule_tests.rb +0 -8
  66. data/tests/models/compute/forwarding_rules_tests.rb +0 -8
  67. data/tests/models/compute/global_forwarding_rule_tests.rb +0 -7
  68. data/tests/models/compute/global_forwarding_rules_tests.rb +0 -7
  69. data/tests/models/compute/http_health_check_tests.rb +0 -5
  70. data/tests/models/compute/http_health_checks_tests.rb +0 -5
  71. data/tests/models/compute/image_tests.rb +0 -6
  72. data/tests/models/compute/images_tests.rb +0 -6
  73. data/tests/models/compute/region_tests.rb +0 -10
  74. data/tests/models/compute/regions_tests.rb +0 -19
  75. data/tests/models/compute/server_tests.rb +0 -37
  76. data/tests/models/compute/servers_tests.rb +0 -14
  77. data/tests/models/compute/target_http_proxies_tests.rb +0 -7
  78. data/tests/models/compute/target_http_proxy_test.rb +0 -6
  79. data/tests/models/compute/target_instance_tests.rb +0 -7
  80. data/tests/models/compute/target_instances_tests.rb +0 -7
  81. data/tests/models/compute/target_pool_tests.rb +0 -12
  82. data/tests/models/compute/target_pools_tests.rb +0 -11
  83. data/tests/models/compute/url_map_tests.rb +0 -6
  84. data/tests/models/compute/url_maps_tests.rb +0 -7
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1.5
@@ -1,15 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'minitest/spec'
3
-
4
- if ENV['COVERAGE']
5
- require 'coveralls'
6
- require 'simplecov'
7
-
8
- SimpleCov.start do
9
- add_filter '/spec/'
10
- end
11
- end
12
-
13
- require File.join(File.dirname(__FILE__), '../lib/fog/google.rb')
14
-
15
- Coveralls.wear! if ENV['COVERAGE']
@@ -1,73 +0,0 @@
1
- require 'google/api_client'
2
-
3
- Shindo.tests('Google | credentials', ['google']) do
4
-
5
- tests('success') do
6
- pending if Fog.mocking?
7
-
8
- google_key_location = Fog.credentials[:google_key_location]
9
- if google_key_location.nil?
10
- tests('Needs a :google_key_location credentials key').pending
11
- end
12
- google_key_string = File.open(File.expand_path(google_key_location), 'rb') { |io| io.read }
13
-
14
- tests("#using_p12_key_file").succeeds do
15
- Fog::Compute::Google.new(:google_key_location => google_key_location,
16
- :google_key_string => nil,
17
- :google_json_key_location => nil,
18
- :google_json_key_string => nil)
19
- end
20
-
21
- tests("#using_p12_key_string").succeeds do
22
- Fog::Compute::Google.new(:google_key_location => nil,
23
- :google_key_string => google_key_string,
24
- :google_json_key_location => nil,
25
- :google_json_key_string => nil)
26
- end
27
- end
28
-
29
- tests('success') do
30
- pending if Fog.mocking?
31
-
32
- google_json_key_location = Fog.credentials[:google_json_key_location]
33
- if google_json_key_location.nil?
34
- tests('Needs a :google_json_key_location credentials key').pending
35
- end
36
- google_json_key_string = File.open(File.expand_path(google_json_key_location), 'rb') { |io| io.read }
37
-
38
- tests("#using_json_key_file").succeeds do
39
- Fog::Compute::Google.new(:google_key_location => nil,
40
- :google_key_string => nil,
41
- :google_json_key_location => google_json_key_location,
42
- :google_json_key_string => nil)
43
- end
44
-
45
- tests("#using_json_key_string").succeeds do
46
- Fog::Compute::Google.new(:google_key_location => nil,
47
- :google_key_string => nil,
48
- :google_json_key_location => nil,
49
- :google_json_key_string => google_json_key_string)
50
- end
51
- end
52
-
53
- tests('failure') do
54
- tests("#missing_google_project").raises(ArgumentError, 'raises ArgumentError when google_project is missing') do
55
- Fog::Compute::Google.new(:google_project => nil)
56
- end
57
-
58
- tests("#missing_google_client_email").raises(ArgumentError, 'raises ArgumentError when google_client_email is missing') do
59
- pending if Fog.mocking? # Mock doesn't check google_client_email
60
- Fog::Compute::Google.new(:google_client_email => nil,
61
- :google_json_key_location => nil) # JSON key overrides google_client_email
62
- end
63
-
64
- tests("#missing_keys").raises(ArgumentError, 'raises ArgumentError when google keys are missing') do
65
- pending if Fog.mocking? # Mock doesn't check missing keys
66
- Fog::Compute::Google.new(:google_key_location => nil,
67
- :google_key_string => nil,
68
- :google_json_key_location => nil,
69
- :google_json_key_string => nil)
70
- end
71
- end
72
-
73
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | backend service model", ['google']) do
3
- random_string = SecureRandom.hex
4
- @health_check = create_test_http_health_check(Fog::Compute[:google])
5
- model_tests(Fog::Compute[:google].backend_services, {:name => "fog-test-backend-service-#{random_string}",
6
- :health_checks => [@health_check.self_link]})
7
- end
@@ -1,8 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | backend_services model", ['google']) do
3
- random_string = SecureRandom.hex
4
- @health_check = create_test_http_health_check(Fog::Compute[:google])
5
- collection_tests(Fog::Compute[:google].backend_services, {:name => "fog-backend-services-test-#{random_string}",
6
- :health_checks => [@health_check.self_link]})
7
-
8
- end
@@ -1,9 +0,0 @@
1
- Shindo.tests("Fog::Compute[:google] | disk model", ['google']) do
2
-
3
- model_tests(Fog::Compute[:google].disks, {:name => 'fog-disk-model-tests',
4
- :zone => 'us-central1-a',
5
- :size_gb => 10}) do |model|
6
- model.wait_for { ready? }
7
- end
8
-
9
- end
@@ -1,22 +0,0 @@
1
- Shindo.tests("Fog::Compute[:google] | disk_types model", ['google']) do
2
- @disk_types = Fog::Compute[:google].disk_types
3
-
4
- tests('success') do
5
-
6
- tests('#all').succeeds do
7
- @disk_types.all
8
- end
9
-
10
- tests('#get').succeeds do
11
- disk_type = @disk_types.all.first
12
- @disk_types.get(disk_type.name)
13
- end
14
-
15
- tests('failure') do
16
- tests('#get').returns(nil) do
17
- @disk_types.get(Fog::Mock.random_letters_and_numbers(16))
18
- end
19
- end
20
-
21
- end
22
- end
@@ -1,9 +0,0 @@
1
- Shindo.tests("Fog::Compute[:google] | disks", ['google']) do
2
-
3
- collection_tests(Fog::Compute[:google].disks, {:name => 'fog-disks-collections-tests',
4
- :zone => 'us-central1-a',
5
- :size_gb => 10}) do |instance|
6
- instance.wait_for { ready? }
7
- end
8
-
9
- end
@@ -1,8 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | forwarding rule model", ['google']) do
3
- random_string = SecureRandom.hex
4
- region = 'us-central1'
5
- target_pool = create_test_target_pool(Fog::Compute[:google], region)
6
- model_tests(Fog::Compute[:google].forwarding_rules, {:name => "fog-test-forwarding-rules-#{random_string}", :region => region, :target => target_pool.self_link})
7
-
8
- end
@@ -1,8 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | forwarding rules model", ['google']) do
3
- random_string = SecureRandom.hex
4
- region = 'us-central1'
5
- target_pool = create_test_target_pool(Fog::Compute[:google], region)
6
- collection_tests(Fog::Compute[:google].forwarding_rules, {:name => "fog-test-forwarding-rule-#{random_string}", :region => region, :target => target_pool.self_link})
7
-
8
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | global forwarding rule model", ['google']) do
3
- random_string = SecureRandom.hex
4
- proxy = create_test_target_http_proxy(Fog::Compute[:google])
5
- model_tests(Fog::Compute[:google].global_forwarding_rules, {:name => "fog-test-global-forwarding-rule-#{random_string}", :target => proxy.self_link})
6
-
7
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | global forwarding rules model", ['google']) do
3
- random_string = SecureRandom.hex
4
- proxy = create_test_target_http_proxy(Fog::Compute[:google])
5
- collection_tests(Fog::Compute[:google].global_forwarding_rules, {:name => "fog-test-global-forwarding-rule-#{random_string}", :target => proxy.self_link})
6
-
7
- end
@@ -1,5 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | HTTP health check model", ['google']) do
3
- random_string = SecureRandom.hex
4
- model_tests(Fog::Compute[:google].http_health_checks, {:name => "fog-test-http-health-check-#{random_string}"})
5
- end
@@ -1,5 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | HTTP health checks model", ['google']) do
3
- random_string = SecureRandom.hex
4
- collection_tests(Fog::Compute[:google].http_health_checks, {:name => "fog-test-http-health-check-#{random_string}"})
5
- end
@@ -1,6 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | image model", ['google']) do
3
- random_string = SecureRandom.hex
4
- source = 'http://storage.googleapis.com/fog-test-bucket/fog-test-raw-disk-source.image.tar.gz'
5
- model_tests(Fog::Compute[:google].images, {:name => "fog-test-images-#{random_string}", "rawDisk" => { "source" => source } })
6
- end
@@ -1,6 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | images model", ['google']) do
3
- random_string = SecureRandom.hex
4
- source = 'http://storage.googleapis.com/fog-test-bucket/fog-test-raw-disk-source.image.tar.gz'
5
- collection_tests(Fog::Compute[:google].images, {:name => "fog-test-images-#{random_string}", "rawDisk" => { "source" => source } })
6
- end
@@ -1,10 +0,0 @@
1
- Shindo.tests("Fog::Compute[:google] | region model", ['google']) do
2
- @regions = Fog::Compute[:google].regions
3
-
4
- tests('success') do
5
- tests('#up').succeeds do
6
- region = @regions.get @regions.all.first.name
7
- region.up?
8
- end
9
- end
10
- end
@@ -1,19 +0,0 @@
1
- Shindo.tests("Fog::Compute[:google] | regions model", ['google']) do
2
- @regions = Fog::Compute[:google].regions
3
-
4
- tests('success') do
5
- tests('#all').succeeds do
6
- @regions.all
7
- end
8
-
9
- tests('#get').succeeds do
10
- @regions.get @regions.all.first.name
11
- end
12
- end
13
-
14
- tests('failure') do
15
- tests('#get').returns(nil) do
16
- @regions.get 'unicorn'
17
- end
18
- end
19
- end
@@ -1,37 +0,0 @@
1
- require 'securerandom'
2
-
3
- Shindo.tests("Fog::Compute[:google] | server model", ['google']) do
4
-
5
- @zone = 'us-central1-a'
6
- @disk = create_test_disk(Fog::Compute[:google], @zone)
7
- random_string = SecureRandom.hex
8
-
9
- model_tests(Fog::Compute[:google].servers, {:name => "fog-test-server-#{random_string}",
10
- :zone_name => @zone,
11
- :machine_type => 'n1-standard-1',
12
- :disks => [@disk]})
13
-
14
- tests('servers') do
15
- @instance = nil
16
- test('#bootstrap') do
17
- attributes = Fog.mocking? ? {:public_key_path => nil, :private_key_path => nil} : {}
18
- @instance = Fog::Compute[:google].servers.bootstrap(attributes)
19
- @instance.ready?
20
- end
21
-
22
- test('#sshable?') do
23
- @instance.wait_for { sshable? }
24
- @instance.sshable?
25
- end
26
-
27
- test('#ssh') do
28
- pending if Fog.mocking?
29
- !!(@instance.ssh("uname").first.stdout =~ /Linux/)
30
- end
31
-
32
- test('#destroy') do
33
- response = @instance.destroy
34
- response.operation_type == 'delete'
35
- end
36
- end
37
- end
@@ -1,14 +0,0 @@
1
- require 'securerandom'
2
-
3
- Shindo.tests("Fog::Compute[:google] | servers", ['google']) do
4
-
5
- @zone = 'us-central1-a'
6
- @disk = create_test_disk(Fog::Compute[:google], @zone)
7
- random_string = SecureRandom.hex
8
-
9
- collection_tests(Fog::Compute[:google].servers, {:name => "fog-test-server-#{random_string}",
10
- :zone_name => @zone,
11
- :machine_type => 'n1-standard-1',
12
- :disks => [@disk]})
13
-
14
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target HTTP proxies model", ['google']) do
3
- url_map = create_test_url_map(Fog::Compute[:google])
4
- random_string = SecureRandom.hex
5
- collection_tests(Fog::Compute[:google].target_http_proxies, {:name => "fog-target-http-proxies-test-#{random_string}", :urlMap => url_map.self_link})
6
-
7
- end
@@ -1,6 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target HTTP proxy model", ['google']) do
3
- random_string = SecureRandom.hex
4
- url_map = create_test_url_map(Fog::Compute[:google])
5
- model_tests(Fog::Compute[:google].target_http_proxies, {:name => "fog-test-target-http-proxy-#{random_string}", :urlMap => url_map.self_link})
6
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target instance model", ['google']) do
3
- random_string = SecureRandom.hex
4
- @zone = 'us-central1-a'
5
- instance = create_test_server(Fog::Compute[:google], @zone)
6
- model_tests(Fog::Compute[:google].target_instances, {:name => "fog-test-target-instance-#{random_string}", :instance => instance.self_link, :zone => @zone})
7
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target instances model", ['google']) do
3
- @zone= 'us-central1-a'
4
- random_string = SecureRandom.hex
5
- instance = create_test_server(Fog::Compute[:google], @zone)
6
- collection_tests(Fog::Compute[:google].target_instances, {:name => "fog-test-target-instances-#{random_string}", :instance => instance.self_link, :zone => @zone})
7
- end
@@ -1,12 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target pool model", ['google']) do
3
-
4
- pending
5
-
6
- random_string = SecureRandom.hex
7
- region = 'us-central1'
8
- instance = create_test_server(Fog::Compute[:google], 'us-central1-a')
9
- health_check = create_test_http_health_check(Fog::Compute[:google])
10
- model_tests(Fog::Compute[:google].target_pools, {:name => "fog-test-target-pool-#{random_string}", :region => region, :instances => [instance.self_link], :healthChecks => [health_check.self_link]})
11
-
12
- end
@@ -1,11 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | target pools model", ['google']) do
3
- random_string = SecureRandom.hex
4
- region = 'us-central1'
5
- instance = create_test_server(Fog::Compute[:google], 'us-central1-a')
6
- health_check = create_test_http_health_check(Fog::Compute[:google])
7
- collection_tests(
8
- Fog::Compute[:google].target_pools,
9
- {:name => "fog-test-target-pool-#{random_string}", :region => region, :instances => [instance.self_link], :healthChecks => [health_check.self_link]}
10
- )
11
- end
@@ -1,6 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | url map model", ['google']) do
3
- random_string = SecureRandom.hex
4
- backend_service = create_test_backend_service(Fog::Compute[:google])
5
- model_tests(Fog::Compute[:google].url_maps, {:name => "fog-test-url-map-#{random_string}", :defaultService => backend_service.self_link})
6
- end
@@ -1,7 +0,0 @@
1
- require 'securerandom'
2
- Shindo.tests("Fog::Compute[:google] | url maps model", ['google']) do
3
- backend_service = create_test_backend_service(Fog::Compute[:google])
4
- random_string = SecureRandom.hex
5
- collection_tests(Fog::Compute[:google].url_maps, {:name => "fog-url-maps-test-#{random_string}", :defaultService => backend_service.self_link})
6
-
7
- end