fog-google 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +5 -5
  2. data/.codecov.yml +2 -0
  3. data/.rubocop.yml +4 -1
  4. data/CHANGELOG.md +51 -0
  5. data/CONTRIBUTING.md +85 -17
  6. data/CONTRIBUTORS.md +6 -4
  7. data/Gemfile +6 -0
  8. data/MIGRATING.md +1 -11
  9. data/README.md +15 -4
  10. data/ci/credentials.yml.template +2 -0
  11. data/ci/docker-image/Dockerfile +1 -3
  12. data/ci/pipeline.yml +117 -12
  13. data/ci/tasks/run-int.sh +3 -2
  14. data/ci/tasks/run-int.yml +1 -1
  15. data/examples/create_instance.rb +40 -25
  16. data/examples/get_list_images.rb +1 -1
  17. data/examples/load-balance.rb +1 -1
  18. data/examples/metadata.rb +1 -1
  19. data/examples/network.rb +1 -1
  20. data/fog-google.gemspec +8 -6
  21. data/lib/fog/compute/google/models/address.rb +1 -1
  22. data/lib/fog/compute/google/models/backend_service.rb +1 -1
  23. data/lib/fog/compute/google/models/disk.rb +2 -2
  24. data/lib/fog/compute/google/models/firewall.rb +23 -3
  25. data/lib/fog/compute/google/models/forwarding_rule.rb +1 -1
  26. data/lib/fog/compute/google/models/global_address.rb +1 -1
  27. data/lib/fog/compute/google/models/global_forwarding_rule.rb +1 -1
  28. data/lib/fog/compute/google/models/http_health_check.rb +2 -2
  29. data/lib/fog/compute/google/models/image.rb +1 -1
  30. data/lib/fog/compute/google/models/instance_group_manager.rb +1 -1
  31. data/lib/fog/compute/google/models/instance_template.rb +1 -1
  32. data/lib/fog/compute/google/models/route.rb +1 -1
  33. data/lib/fog/compute/google/models/server.rb +59 -5
  34. data/lib/fog/compute/google/models/servers.rb +1 -1
  35. data/lib/fog/compute/google/models/ssl_certificate.rb +1 -1
  36. data/lib/fog/compute/google/models/subnetwork.rb +1 -1
  37. data/lib/fog/compute/google/models/target_http_proxy.rb +1 -1
  38. data/lib/fog/compute/google/models/target_https_proxy.rb +14 -1
  39. data/lib/fog/compute/google/models/target_instance.rb +1 -1
  40. data/lib/fog/compute/google/models/target_pool.rb +1 -1
  41. data/lib/fog/compute/google/models/url_map.rb +1 -1
  42. data/lib/fog/compute/google/requests/insert_server.rb +1 -1
  43. data/lib/fog/dns/google/models/record.rb +1 -1
  44. data/lib/fog/google/models/sql/instance.rb +1 -1
  45. data/lib/fog/google/models/sql/user.rb +1 -1
  46. data/lib/fog/google/version.rb +1 -1
  47. data/lib/fog/storage/google_json.rb +4 -1
  48. data/lib/fog/storage/google_json/mock.rb +3 -0
  49. data/lib/fog/storage/google_json/models/file.rb +2 -2
  50. data/lib/fog/storage/google_json/models/files.rb +2 -2
  51. data/lib/fog/storage/google_json/real.rb +3 -0
  52. data/lib/fog/storage/google_json/requests/get_object_http_url.rb +6 -7
  53. data/lib/fog/storage/google_json/requests/get_object_https_url.rb +6 -7
  54. data/lib/fog/storage/google_json/requests/get_object_url.rb +4 -4
  55. data/lib/fog/storage/google_json/utils.rb +7 -1
  56. data/lib/fog/storage/google_xml/models/file.rb +2 -2
  57. data/lib/fog/storage/google_xml/models/files.rb +4 -4
  58. data/lib/fog/storage/google_xml/requests/get_object_http_url.rb +8 -7
  59. data/lib/fog/storage/google_xml/requests/get_object_https_url.rb +7 -7
  60. data/lib/fog/storage/google_xml/requests/get_object_url.rb +5 -4
  61. data/lib/fog/storage/google_xml/utils.rb +7 -1
  62. data/tasks/test.rake +45 -23
  63. data/test/helpers/integration_test_helper.rb +67 -0
  64. data/test/helpers/test_helper.rb +14 -10
  65. data/test/integration/compute/core_compute/test_coverage.rb +6 -0
  66. data/test/integration/compute/{test_disk_types.rb → core_compute/test_disk_types.rb} +0 -0
  67. data/test/integration/compute/{disks/test_compute_disk_models.rb → core_compute/test_disks.rb} +0 -0
  68. data/test/integration/compute/{test_images.rb → core_compute/test_images.rb} +0 -0
  69. data/test/integration/compute/core_compute/test_machine_types.rb +42 -0
  70. data/test/integration/compute/core_compute/test_operations.rb +27 -0
  71. data/test/integration/compute/core_compute/test_projects.rb +19 -0
  72. data/test/integration/compute/{test_regions.rb → core_compute/test_regions.rb} +0 -0
  73. data/test/integration/compute/core_compute/test_servers.rb +109 -0
  74. data/test/integration/compute/{test_snapshots.rb → core_compute/test_snapshots.rb} +0 -0
  75. data/test/integration/compute/core_compute/test_zones.rb +35 -0
  76. data/test/integration/compute/core_networking/test_addresses.rb +84 -0
  77. data/test/integration/compute/core_networking/test_coverage.rb +6 -0
  78. data/test/integration/compute/core_networking/test_firewalls.rb +11 -0
  79. data/test/integration/compute/core_networking/test_networks.rb +41 -0
  80. data/test/integration/compute/core_networking/test_routes.rb +26 -0
  81. data/test/integration/compute/core_networking/test_subnetworks.rb +11 -0
  82. data/test/integration/compute/instance_groups/test_coverage.rb +6 -0
  83. data/test/integration/compute/{test_instance_group_managers.rb → instance_groups/test_instance_group_managers.rb} +0 -0
  84. data/test/integration/compute/instance_groups/test_instance_groups.rb +11 -0
  85. data/test/integration/compute/{test_instance_templates.rb → instance_groups/test_instance_templates.rb} +0 -0
  86. data/test/integration/compute/{test_backend_services.rb → loadbalancing/test_backend_services.rb} +0 -0
  87. data/test/integration/compute/loadbalancing/test_coverage.rb +6 -0
  88. data/test/integration/compute/{test_forwarding_rules.rb → loadbalancing/test_forwarding_rules.rb} +0 -0
  89. data/test/integration/compute/loadbalancing/test_global_addresses.rb +11 -0
  90. data/test/integration/compute/{test_global_forwarding_rules.rb → loadbalancing/test_global_forwarding_rules.rb} +0 -0
  91. data/test/integration/compute/{test_http_health_checks.rb → loadbalancing/test_http_health_checks.rb} +0 -0
  92. data/test/integration/compute/loadbalancing/test_ssl_certificates.rb +11 -0
  93. data/test/integration/compute/{test_target_http_proxies.rb → loadbalancing/test_target_http_proxies.rb} +0 -0
  94. data/test/integration/compute/loadbalancing/test_target_https_proxies.rb +11 -0
  95. data/test/integration/compute/{test_target_instances.rb → loadbalancing/test_target_instances.rb} +0 -0
  96. data/test/integration/compute/loadbalancing/test_target_pools.rb +55 -0
  97. data/test/integration/compute/{test_url_maps.rb → loadbalancing/test_url_maps.rb} +0 -0
  98. data/test/integration/factories/addresses_factory.rb +16 -0
  99. data/test/integration/factories/collection_factory.rb +24 -3
  100. data/test/integration/factories/disks_factory.rb +1 -0
  101. data/test/integration/factories/firewalls_factory.rb +13 -0
  102. data/test/integration/factories/global_addresses_factory.rb +15 -0
  103. data/test/integration/factories/instance_groups_factory.rb +16 -0
  104. data/test/integration/factories/instance_template_factory.rb +1 -0
  105. data/test/integration/factories/networks_factory.rb +16 -0
  106. data/test/integration/factories/ssl_certificates_factory.rb +13 -0
  107. data/test/integration/factories/subnetworks_factory.rb +22 -0
  108. data/test/integration/factories/target_https_proxies_factory.rb +26 -0
  109. data/test/integration/factories/target_pools_factory.rb +2 -2
  110. data/test/integration/monitoring/test_coverage.rb +6 -0
  111. data/test/integration/monitoring/test_timeseries.rb +1 -1
  112. data/test/integration/pubsub/test_coverage.rb +6 -0
  113. data/test/integration/sql/{test_common_flags.rb → sqlv1/test_common_flags.rb} +0 -0
  114. data/test/integration/sql/{test_common_tiers.rb → sqlv1/test_common_tiers.rb} +0 -0
  115. data/test/integration/sql/sqlv1/test_coverage.rb +6 -0
  116. data/test/integration/sql/{test_v1_certs.rb → sqlv1/test_v1_certs.rb} +0 -0
  117. data/test/integration/sql/{test_v1_instances.rb → sqlv1/test_v1_instances.rb} +0 -0
  118. data/test/integration/sql/{test_v1_users.rb → sqlv1/test_v1_users.rb} +0 -0
  119. data/test/integration/sql/sqlv2/test_coverage.rb +6 -0
  120. data/test/integration/sql/{test_v2_instances.rb → sqlv2/test_v2_instances.rb} +0 -0
  121. data/test/integration/storage/test_coverage.rb +6 -0
  122. data/test/unit/storage/test_json_requests.rb +45 -0
  123. data/test/unit/storage/test_xml_requests.rb +20 -0
  124. metadata +115 -92
  125. data/test/integration/compute/addresses/addresses_shared.rb +0 -59
  126. data/test/integration/compute/addresses/test_compute_address_models.rb +0 -105
  127. data/test/integration/compute/addresses/test_compute_address_requests.rb +0 -52
  128. data/test/integration/compute/disks/test_compute_disk_requests.rb +0 -92
  129. data/test/integration/compute/test_compute_addresses_collection.rb +0 -75
  130. data/test/integration/compute/test_compute_networks_collection.rb +0 -69
  131. data/test/integration/compute/test_servers.rb +0 -54
  132. data/test/integration/compute/test_target_pools.rb +0 -38
@@ -50,7 +50,7 @@ module Fog
50
50
 
51
51
  if disks.nil? || disks.empty?
52
52
  # create the persistent boot disk
53
- source_img = service.images.get_from_family("debian-8")
53
+ source_img = service.images.get_from_family("debian-9")
54
54
  disk_defaults = {
55
55
  :name => name,
56
56
  :size_gb => 10,
@@ -24,7 +24,7 @@ module Fog
24
24
  )
25
25
  operation = Fog::Compute::Google::Operations.new(:service => service)
26
26
  .get(data.name)
27
- operation.wait_for { !pending? }
27
+ operation.wait_for { ready? }
28
28
  reload
29
29
  end
30
30
 
@@ -26,7 +26,7 @@ module Fog
26
26
  data = service.insert_subnetwork(identity, region, network, ip_cidr_range, attributes)
27
27
  operation = Fog::Compute::Google::Operations.new(:service => service)
28
28
  .get(data.name, nil, data.region)
29
- operation.wait_for { !pending? }
29
+ operation.wait_for { ready? }
30
30
  reload
31
31
  end
32
32
 
@@ -18,7 +18,7 @@ module Fog
18
18
  )
19
19
  operation = Fog::Compute::Google::Operations.new(:service => service)
20
20
  .get(data.name)
21
- operation.wait_for { !pending? }
21
+ operation.wait_for { ready? }
22
22
  reload
23
23
  end
24
24
 
@@ -10,11 +10,24 @@ module Fog
10
10
  attribute :kind, :aliases => "kind"
11
11
  attribute :self_link, :aliases => "selfLink"
12
12
  attribute :url_map, :aliases => "urlMap"
13
+ # Array of SSL Certificates
14
+ # @example
15
+ #
16
+ # [cert_one.self_link', cert_two.self_link]
17
+ #
18
+ # , where 'cert_one' and 'cert_two' are instances of
19
+ # Fog::Compute::Google::SslCertificate
20
+ #
21
+ # @return [Array<String>]
13
22
  attribute :ssl_certificates, :aliases => "sslCertificates"
14
23
 
15
24
  def save
16
25
  requires :identity, :url_map, :ssl_certificates
17
26
 
27
+ unless ssl_certificates.is_a?(Array)
28
+ raise Fog::Errors::Error.new("ssl_certificates attribute must be an array")
29
+ end
30
+
18
31
  data = service.insert_target_https_proxy(
19
32
  identity,
20
33
  :description => description,
@@ -23,7 +36,7 @@ module Fog
23
36
  )
24
37
  operation = Fog::Compute::Google::Operations.new(:service => service)
25
38
  .get(data.name)
26
- operation.wait_for { !pending? }
39
+ operation.wait_for { ready? }
27
40
  reload
28
41
  end
29
42
 
@@ -26,7 +26,7 @@ module Fog
26
26
  data = service.insert_target_instance(identity, zone, options)
27
27
  operation = Fog::Compute::Google::Operations.new(:service => service)
28
28
  .get(data.name, data.zone)
29
- operation.wait_for { !pending? }
29
+ operation.wait_for { ready? }
30
30
  reload
31
31
  end
32
32
 
@@ -25,7 +25,7 @@ module Fog
25
25
  operation = Fog::Compute::Google::Operations
26
26
  .new(:service => service)
27
27
  .get(data.name, nil, data.region)
28
- operation.wait_for { !pending? }
28
+ operation.wait_for { ready? }
29
29
  reload
30
30
  end
31
31
 
@@ -36,7 +36,7 @@ module Fog
36
36
  end
37
37
  operation = Fog::Compute::Google::Operations.new(:service => service)
38
38
  .get(data.name)
39
- operation.wait_for { !pending? }
39
+ operation.wait_for { ready? }
40
40
  reload
41
41
  end
42
42
 
@@ -50,7 +50,7 @@ module Fog
50
50
  # :disks => [
51
51
  # {
52
52
  # :initialize_params => {
53
- # :source_image => "projects/debian-cloud/global/images/family/debian-8"
53
+ # :source_image => "projects/debian-cloud/global/images/family/debian-9"
54
54
  # }
55
55
  # }
56
56
  # ]
@@ -72,7 +72,7 @@ module Fog
72
72
  change = Fog::DNS::Google::Changes
73
73
  .new(:service => service, :zone => zone)
74
74
  .get(data.id)
75
- change.wait_for { !pending? }
75
+ change.wait_for { ready? }
76
76
  self
77
77
  end
78
78
 
@@ -318,7 +318,7 @@ module Fog
318
318
 
319
319
  data = service.update_instance(identity, settings_version, tier, settings)
320
320
  operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
321
- operation.wait_for { !pending? }
321
+ operation.wait_for { ready? }
322
322
  reload
323
323
  end
324
324
 
@@ -42,7 +42,7 @@ module Fog
42
42
  end
43
43
 
44
44
  operation = Fog::Google::SQL::Operations.new(:service => service).get(resp.name)
45
- operation.wait_for { !pending? }
45
+ operation.wait_for { ready? }
46
46
  end
47
47
  end
48
48
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Google
3
- VERSION = "1.6.0".freeze
3
+ VERSION = "1.7.0".freeze
4
4
  end
5
5
  end
@@ -16,7 +16,10 @@ module Fog
16
16
  :google_key_location,
17
17
  :google_key_string,
18
18
  :google_json_key_location,
19
- :google_json_key_string
19
+ :google_json_key_string,
20
+ :open_timeout_sec,
21
+ :read_timeout_sec,
22
+ :send_timeout_sec
20
23
  )
21
24
 
22
25
  # https://cloud.google.com/storage/docs/json_api/v1/
@@ -5,8 +5,11 @@ module Fog
5
5
  include Utils
6
6
  include Fog::Google::Shared
7
7
 
8
+ MockClient = Struct.new(:issuer)
9
+
8
10
  def initialize(options = {})
9
11
  shared_initialize(options[:google_project], GOOGLE_STORAGE_JSON_API_VERSION, GOOGLE_STORAGE_JSON_BASE_URL)
12
+ @client = MockClient.new('test')
10
13
  end
11
14
 
12
15
  def signature(_params)
@@ -112,9 +112,9 @@ module Fog
112
112
  end
113
113
 
114
114
  # params[:expires] : Eg: Time.now to integer value.
115
- def url(expires)
115
+ def url(expires, options = {})
116
116
  requires :key
117
- collection.get_https_url(key, expires)
117
+ collection.get_https_url(key, expires, options)
118
118
  end
119
119
 
120
120
  private
@@ -40,9 +40,9 @@ module Fog
40
40
  nil
41
41
  end
42
42
 
43
- def get_https_url(key, expires)
43
+ def get_https_url(key, expires, options = {})
44
44
  requires :directory
45
- service.get_object_https_url(directory.key, key, expires)
45
+ service.get_object_https_url(directory.key, key, expires, options)
46
46
  end
47
47
 
48
48
  def metadata(key, options = {})
@@ -15,6 +15,9 @@ module Fog
15
15
 
16
16
  @client = initialize_google_client(options)
17
17
  @storage_json = ::Google::Apis::StorageV1::StorageService.new
18
+ @storage_json.client_options.open_timeout_sec = options[:open_timeout_sec] if options[:open_timeout_sec]
19
+ @storage_json.client_options.read_timeout_sec = options[:read_timeout_sec] if options[:read_timeout_sec]
20
+ @storage_json.client_options.send_timeout_sec = options[:send_timeout_sec] if options[:send_timeout_sec]
18
21
  end
19
22
 
20
23
  def signature(params)
@@ -2,15 +2,14 @@ module Fog
2
2
  module Storage
3
3
  class GoogleJSON
4
4
  module GetObjectHttpUrl
5
- def get_object_http_url(bucket_name, object_name, expires)
5
+ def get_object_http_url(bucket_name, object_name, expires, options = {})
6
6
  raise ArgumentError.new("bucket_name is required") unless bucket_name
7
7
  raise ArgumentError.new("object_name is required") unless object_name
8
- http_url({
9
- :headers => {},
10
- :host => @host,
11
- :method => "GET",
12
- :path => "#{bucket_name}/#{object_name}"
13
- }, expires)
8
+ http_url(options.merge(:headers => {},
9
+ :host => @host,
10
+ :method => "GET",
11
+ :path => "#{bucket_name}/#{object_name}"),
12
+ expires)
14
13
  end
15
14
  end
16
15
 
@@ -2,16 +2,15 @@ module Fog
2
2
  module Storage
3
3
  class GoogleJSON
4
4
  module GetObjectHttpsUrl
5
- def get_object_https_url(bucket_name, object_name, expires)
5
+ def get_object_https_url(bucket_name, object_name, expires, options = {})
6
6
  raise ArgumentError.new("bucket_name is required") unless bucket_name
7
7
  raise ArgumentError.new("object_name is required") unless object_name
8
8
 
9
- https_url({
10
- :headers => {},
11
- :host => @host,
12
- :method => "GET",
13
- :path => "#{bucket_name}/#{object_name}"
14
- }, expires)
9
+ https_url(options.merge(:headers => {},
10
+ :host => @host,
11
+ :method => "GET",
12
+ :path => "#{bucket_name}/#{object_name}"),
13
+ expires)
15
14
  end
16
15
  end
17
16
 
@@ -4,16 +4,16 @@ module Fog
4
4
  class Real
5
5
  # Get an expiring object url from GCS
6
6
  # Deprecated, redirects to get_object_https_url.rb
7
- def get_object_url(bucket_name, object_name, expires)
7
+ def get_object_url(bucket_name, object_name, expires, options = {})
8
8
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(0..0)})")
9
- get_object_https_url(bucket_name, object_name, expires)
9
+ get_object_https_url(bucket_name, object_name, expires, options)
10
10
  end
11
11
  end
12
12
 
13
13
  class Mock # :nodoc:all
14
- def get_object_url(bucket_name, object_name, expires)
14
+ def get_object_url(bucket_name, object_name, expires, options = {})
15
15
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(0..0)})")
16
- get_object_https_url(bucket_name, object_name, expires)
16
+ get_object_https_url(bucket_name, object_name, expires, options)
17
17
  end
18
18
  end
19
19
  end
@@ -20,7 +20,13 @@ module Fog
20
20
  def host_path_query(params, expires)
21
21
  params[:headers]["Date"] = expires.to_i
22
22
  params[:path] = URI.encode(params[:path]).gsub("%2F", "/")
23
- query = [params[:query]].compact
23
+ query = []
24
+
25
+ if params[:query]
26
+ filtered = params[:query].reject { |k, v| k.nil? || v.nil? }
27
+ query = filtered.map { |k, v| [k.to_s, Fog::Google.escape(v)].join("=") }
28
+ end
29
+
24
30
  query << "GoogleAccessId=#{@client.issuer}"
25
31
  query << "Signature=#{CGI.escape(signature(params))}"
26
32
  query << "Expires=#{params[:headers]['Date']}"
@@ -116,9 +116,9 @@ module Fog
116
116
  true
117
117
  end
118
118
 
119
- def url(expires)
119
+ def url(expires, options = {})
120
120
  requires :key
121
- collection.get_http_url(key, expires)
121
+ collection.get_http_url(key, expires, options)
122
122
  end
123
123
 
124
124
  private
@@ -66,14 +66,14 @@ module Fog
66
66
  nil
67
67
  end
68
68
 
69
- def get_http_url(key, expires)
69
+ def get_http_url(key, expires, options = {})
70
70
  requires :directory
71
- service.get_object_http_url(directory.key, key, expires)
71
+ service.get_object_http_url(directory.key, key, expires, options)
72
72
  end
73
73
 
74
- def get_https_url(key, expires)
74
+ def get_https_url(key, expires, options = {})
75
75
  requires :directory
76
- service.get_object_https_url(directory.key, key, expires)
76
+ service.get_object_https_url(directory.key, key, expires, options)
77
77
  end
78
78
 
79
79
  def head(key, options = {})
@@ -2,15 +2,16 @@ module Fog
2
2
  module Storage
3
3
  class GoogleXML
4
4
  module GetObjectHttpUrl
5
- def get_object_http_url(bucket_name, object_name, expires)
5
+ def get_object_http_url(bucket_name, object_name, expires, options = {})
6
6
  raise ArgumentError.new("bucket_name is required") unless bucket_name
7
7
  raise ArgumentError.new("object_name is required") unless object_name
8
- http_url({
9
- :headers => {},
10
- :host => @host,
11
- :method => "GET",
12
- :path => "#{bucket_name}/#{object_name}"
13
- }, expires)
8
+
9
+ https_url(options.merge(:headers => {},
10
+ :host => @host,
11
+ :method => "GET",
12
+ :path => "#{bucket_name}/#{object_name}"),
13
+ expires)
14
+ http_url(url_options, expires)
14
15
  end
15
16
  end
16
17
 
@@ -2,15 +2,15 @@ module Fog
2
2
  module Storage
3
3
  class GoogleXML
4
4
  module GetObjectHttpsUrl
5
- def get_object_https_url(bucket_name, object_name, expires)
5
+ def get_object_https_url(bucket_name, object_name, expires, options)
6
6
  raise ArgumentError.new("bucket_name is required") unless bucket_name
7
7
  raise ArgumentError.new("object_name is required") unless object_name
8
- https_url({
9
- :headers => {},
10
- :host => @host,
11
- :method => "GET",
12
- :path => "#{bucket_name}/#{object_name}"
13
- }, expires)
8
+
9
+ https_url(options.merge(:headers => {},
10
+ :host => @host,
11
+ :method => "GET",
12
+ :path => "#{bucket_name}/#{object_name}"),
13
+ expires)
14
14
  end
15
15
  end
16
16
 
@@ -8,21 +8,22 @@ module Fog
8
8
  # * bucket_name<~String> - Name of bucket containing object
9
9
  # * object_name<~String> - Name of object to get expiring url for
10
10
  # * expires<~Time> - An expiry time for this url
11
+ # * options<~Hash> - A list of key-value pairs to send as query strings
11
12
  #
12
13
  # ==== Returns
13
14
  # * response<~Excon::Response>:
14
15
  # * body<~String> - url for object
15
16
 
16
- def get_object_url(bucket_name, object_name, expires)
17
+ def get_object_url(bucket_name, object_name, expires, options = {})
17
18
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(1..1).first})")
18
- get_object_https_url(bucket_name, object_name, expires)
19
+ get_object_https_url(bucket_name, object_name, expires, options)
19
20
  end
20
21
  end
21
22
 
22
23
  class Mock # :nodoc:all
23
- def get_object_url(bucket_name, object_name, expires)
24
+ def get_object_url(bucket_name, object_name, expires, options = {})
24
25
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(1..1).first})")
25
- get_object_https_url(bucket_name, object_name, expires)
26
+ get_object_https_url(bucket_name, object_name, expires, options)
26
27
  end
27
28
  end
28
29
  end
@@ -31,7 +31,13 @@ module Fog
31
31
  def host_path_query(params, expires)
32
32
  params[:headers]["Date"] = expires.to_i
33
33
  params[:path] = Fog::Google.escape(params[:path]).gsub("%2F", "/")
34
- query = [params[:query]].compact
34
+ query = []
35
+
36
+ if params[:query]
37
+ filtered = params[:query].reject { |k, v| k.nil? || v.nil? }
38
+ query = filtered.map { |k, v| [k.to_s, Fog::Google.escape(v)].join("=") }
39
+ end
40
+
35
41
  query << "GoogleAccessId=#{@google_storage_access_key_id}"
36
42
  query << "Signature=#{CGI.escape(signature(params))}"
37
43
  query << "Expires=#{params[:headers]['Date']}"
data/tasks/test.rake CHANGED
@@ -17,28 +17,40 @@ namespace :test do
17
17
  multitask :parallel => ["test:compute",
18
18
  "test:monitoring",
19
19
  "test:pubsub",
20
- "test:sqlv1",
21
- "test:sqlv2",
20
+ "test:sql",
22
21
  "test:storage"]
23
22
 
24
23
  Rake::TestTask.new do |t|
25
24
  t.name = "unit"
26
25
  t.description = "Run Unit tests"
27
26
  t.libs << "test"
28
- t.pattern = FileList['test/unit/**/test_*.rb']
27
+ t.pattern = FileList["test/unit/**/test_*.rb"]
29
28
  t.warning = false
30
29
  t.verbose = true
31
30
  end
32
31
 
33
- Rake::TestTask.new do |t|
34
- t.name = "compute"
35
- t.description = "Run Compute API tests"
36
- t.libs << "test"
37
- t.pattern = FileList["test/integration/compute/test_*.rb"]
38
- t.warning = false
39
- t.verbose = true
32
+ # This autogenerates rake tasks based on test folder structures
33
+ # This is done to simplify running many test suites in parallel
34
+ COMPUTE_TEST_TASKS = []
35
+ Dir.glob("test/integration/compute/**").each do |task|
36
+ suite_collection = task.gsub(/test\/integration\/compute\//, "")
37
+ component_name = task.gsub(/test\/integration\//, "").split("/").first
38
+ Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
39
+ t.libs << "test"
40
+ t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
41
+ t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
42
+ t.warning = false
43
+ t.verbose = true
44
+ end
45
+ COMPUTE_TEST_TASKS << "#{component_name}-#{suite_collection}"
40
46
  end
41
47
 
48
+ desc "Run Compute API tests"
49
+ task :compute => COMPUTE_TEST_TASKS
50
+
51
+ desc "Run Compute API tests in parallel"
52
+ multitask :compute_parallel => COMPUTE_TEST_TASKS
53
+
42
54
  Rake::TestTask.new do |t|
43
55
  t.name = "monitoring"
44
56
  t.description = "Run Monitoring API tests"
@@ -57,23 +69,33 @@ namespace :test do
57
69
  t.verbose = true
58
70
  end
59
71
 
60
- desc "Run all SQL API tests"
61
- task :sql => [:sqlv1, :sqlv2]
62
-
63
- Rake::TestTask.new do |t|
64
- t.name = "sqlv1"
65
- t.description = "Run SQLv1 API tests"
66
- t.libs << "test"
67
- t.pattern = FileList["test/integration/sql/test_common*.rb", "test/integration/sql/test_v1*.rb"]
68
- t.warning = false
69
- t.verbose = true
72
+ # This autogenerates rake tasks based on test folder structures
73
+ # This is done to simplify running many test suites in parallel
74
+ SQL_TEST_TASKS = []
75
+ Dir.glob("test/integration/sql/**").each do |task|
76
+ suite_collection = task.gsub(/test\/integration\/sql\//, "")
77
+ component_name = task.gsub(/test\/integration\//, "").split("/").first
78
+ Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
79
+ t.libs << "test"
80
+ t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
81
+ t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
82
+ t.warning = false
83
+ t.verbose = true
84
+ end
85
+ SQL_TEST_TASKS << "#{component_name}-#{suite_collection}"
70
86
  end
71
87
 
88
+ desc "Run SQL API tests"
89
+ task :compute => SQL_TEST_TASKS
90
+
91
+ desc "Run SQL API tests in parallel"
92
+ multitask :compute_parallel => SQL_TEST_TASKS
93
+
72
94
  Rake::TestTask.new do |t|
73
- t.name = "sqlv2"
74
- t.description = "Run SQLv2 API tests"
95
+ t.name = "sql"
96
+ t.description = "Run SQL API tests"
75
97
  t.libs << "test"
76
- t.pattern = FileList["test/integration/sql/test_v2*.rb"]
98
+ t.pattern = FileList["test/integration/sql/test_*.rb"]
77
99
  t.warning = false
78
100
  t.verbose = true
79
101
  end