fog-google 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -5
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +79 -0
  6. data/CONTRIBUTING.md +9 -10
  7. data/README.md +5 -5
  8. data/ci/README.md +5 -10
  9. data/ci/credentials.yml.template +28 -0
  10. data/ci/pipeline.yml +72 -11
  11. data/ci/tasks/run-int.sh +2 -1
  12. data/ci/tasks/run-int.yml +1 -0
  13. data/examples/create_instance.rb +4 -4
  14. data/examples/get_list_images.rb +1 -1
  15. data/examples/load-balance.rb +1 -1
  16. data/examples/metadata.rb +1 -1
  17. data/examples/network.rb +1 -1
  18. data/examples/storage_json.rb +1 -1
  19. data/fog-google.gemspec +3 -1
  20. data/lib/fog/compute/google.rb +2 -0
  21. data/lib/fog/compute/google/mock.rb +0 -19
  22. data/lib/fog/compute/google/models/disk.rb +12 -5
  23. data/lib/fog/compute/google/models/instance_group.rb +4 -0
  24. data/lib/fog/compute/google/models/network.rb +8 -2
  25. data/lib/fog/compute/google/models/server.rb +28 -4
  26. data/lib/fog/compute/google/models/servers.rb +1 -0
  27. data/lib/fog/compute/google/models/subnetworks.rb +1 -1
  28. data/lib/fog/compute/google/models/target_pool.rb +12 -1
  29. data/lib/fog/compute/google/requests/insert_disk.rb +12 -5
  30. data/lib/fog/compute/google/requests/insert_server.rb +6 -1
  31. data/lib/fog/compute/google/requests/insert_url_map.rb +12 -1
  32. data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -0
  33. data/lib/fog/google/shared.rb +1 -2
  34. data/lib/fog/google/version.rb +1 -1
  35. data/lib/fog/storage/google_json/models/file.rb +31 -1
  36. data/lib/fog/storage/google_json/requests/put_object.rb +22 -12
  37. data/lib/fog/storage/google_xml/models/directory.rb +2 -3
  38. data/lib/fog/storage/google_xml/models/file.rb +2 -13
  39. data/lib/fog/storage/google_xml/requests/put_bucket.rb +1 -1
  40. data/lib/fog/storage/google_xml/requests/put_object.rb +1 -1
  41. data/lib/fog/storage/google_xml/requests/put_object_acl.rb +11 -2
  42. data/lib/fog/storage/google_xml/utils.rb +11 -0
  43. data/tasks/test.rake +63 -1
  44. data/test/integration/compute/addresses/addresses_shared.rb +1 -1
  45. data/test/integration/compute/test_compute_addresses_collection.rb +4 -3
  46. data/test/integration/compute/test_compute_networks_collection.rb +9 -6
  47. data/test/integration/compute/test_servers.rb +9 -0
  48. data/test/integration/compute/test_target_pools.rb +22 -0
  49. data/test/integration/factories/collection_factory.rb +1 -1
  50. data/test/integration/monitoring/test_timeseries.rb +78 -28
  51. data/test/integration/storage/test_files.rb +1 -1
  52. data/test/integration/storage/test_objects.rb +6 -0
  53. data/test/integration/test_authentication.rb +0 -18
  54. data/test/unit/compute/test_common_collections.rb +31 -0
  55. data/test/unit/compute/test_common_models.rb +36 -0
  56. metadata +39 -6
  57. data/ci/credentials.yml.tpl +0 -13
@@ -37,7 +37,7 @@ class TestStorageRequests < StorageShared
37
37
  end
38
38
 
39
39
  def test_files_create_invalid_predefined_acl
40
- assert_raises(Google::Apis::ClientError) do
40
+ assert_raises(ArgumentError) do
41
41
  @client.directories.get(some_bucket_name).files.create(
42
42
  :key => new_object_name,
43
43
  :body => some_temp_file,
@@ -15,6 +15,12 @@ class TestStorageRequests < StorageShared
15
15
  assert_equal(temp_file_content, object[:body])
16
16
  end
17
17
 
18
+ def test_put_object_nil
19
+ assert_raises(ArgumentError) do
20
+ @client.put_object(some_bucket_name, new_object_name, nil)
21
+ end
22
+ end
23
+
18
24
  def test_put_object_file
19
25
  object_name = new_object_name
20
26
  expected_body = "A file body"
@@ -3,28 +3,10 @@ require "helpers/integration_test_helper"
3
3
  # TODO: this is a port over from legacy tests. It shouldn't be scoped under Google, but under Google::Shared.
4
4
  class TestAuthentication < FogIntegrationTest
5
5
  def setup
6
- @google_key_location = Fog.credentials[:google_key_location]
7
- @google_key_string = File.open(File.expand_path(@google_key_location), "rb", &:read)
8
6
  @google_json_key_location = Fog.credentials[:google_json_key_location]
9
7
  @google_json_key_string = File.open(File.expand_path(@google_json_key_location), "rb", &:read)
10
8
  end
11
9
 
12
- def test_authenticates_with_p12_key_location
13
- c = Fog::Compute::Google.new(:google_key_location => @google_key_location,
14
- :google_key_string => nil,
15
- :google_json_key_location => nil,
16
- :google_json_key_string => nil)
17
- assert_kind_of(Fog::Compute::Google::Real, c)
18
- end
19
-
20
- def test_authenticates_with_p12_key_string
21
- c = Fog::Compute::Google.new(:google_key_location => nil,
22
- :google_key_string => @google_key_string,
23
- :google_json_key_location => nil,
24
- :google_json_key_string => nil)
25
- assert_kind_of(Fog::Compute::Google::Real, c)
26
- end
27
-
28
10
  def test_authenticates_with_json_key_location
29
11
  c = Fog::Compute::Google.new(:google_key_location => nil,
30
12
  :google_key_string => nil,
@@ -0,0 +1,31 @@
1
+ require "helpers/test_helper"
2
+
3
+ class UnitTestCollections < MiniTest::Test
4
+ def setup
5
+ Fog.mock!
6
+ @client = Fog::Compute.new(:provider => "Google", :google_project => "foo")
7
+
8
+ # Top-level ancestors we do not dest
9
+ common_ancestors = [Fog::Collection, Fog::Association, Fog::PagedCollection]
10
+ # Projects do not have a "list" method in compute API
11
+ exceptions = [Fog::Compute::Google::Projects]
12
+ # Enumerate all descendants of Fog::Collection
13
+ descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a
14
+
15
+ @collections = descendants - common_ancestors - exceptions
16
+ end
17
+
18
+ def teardown
19
+ Fog.unmock!
20
+ end
21
+
22
+ def test_common_methods
23
+ # This tests whether Fog::Compute::Google collections have common lifecycle methods
24
+ @collections.each do |klass|
25
+ obj = klass.new
26
+ assert obj.respond_to?(:all), "#{klass} should have an .all method"
27
+ assert obj.respond_to?(:get), "#{klass} should have a .get method"
28
+ assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ require "helpers/test_helper"
2
+
3
+ class UnitTestModels < MiniTest::Test
4
+ def setup
5
+ Fog.mock!
6
+ @client = Fog::Compute.new(:provider => "Google", :google_project => "foo")
7
+
8
+ # Top-level ancestors we do not test
9
+ common_ancestors = [Fog::Model, Fog::Compute::Server]
10
+ # Do not test models that do not have a create method in API
11
+ exceptions = [ Fog::Compute::Google::MachineType,
12
+ Fog::Compute::Google::Region,
13
+ Fog::Compute::Google::DiskType,
14
+ Fog::Compute::Google::Operation,
15
+ Fog::Compute::Google::Zone,
16
+ Fog::Compute::Google::Snapshot,
17
+ Fog::Compute::Google::Project ]
18
+ # Enumerate all descendants of Fog::Model
19
+ descendants = ObjectSpace.each_object(Fog::Model.singleton_class).to_a
20
+
21
+ @models = descendants - common_ancestors - exceptions
22
+ end
23
+
24
+ def teardown
25
+ Fog.unmock!
26
+ end
27
+
28
+ def test_common_methods
29
+ # This tests whether Fog::Compute::Google models have common lifecycle methods
30
+ @models.each do |klass|
31
+ obj = klass.new
32
+ assert obj.respond_to?(:save), "#{klass} should have a .save method"
33
+ assert obj.respond_to?(:destroy), "#{klass} should have a .destroy method"
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Welch
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-16 00:00:00.000000000 Z
12
+ date: 2018-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog-core
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.19.1
62
+ version: 0.23.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.19.1
69
+ version: 0.23.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: coveralls
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: pry-byebug
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  - !ruby/object:Gem::Dependency
141
155
  name: rake
142
156
  requirement: !ruby/object:Gem::Requirement
@@ -151,6 +165,20 @@ dependencies:
151
165
  - - ">="
152
166
  - !ruby/object:Gem::Version
153
167
  version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: retriable
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
154
182
  - !ruby/object:Gem::Dependency
155
183
  name: rubocop
156
184
  requirement: !ruby/object:Gem::Requirement
@@ -223,6 +251,7 @@ files:
223
251
  - ".rubocop.yml"
224
252
  - ".ruby-gemset"
225
253
  - ".travis.yml"
254
+ - CHANGELOG.md
226
255
  - CONTRIBUTING.md
227
256
  - CONTRIBUTORS.md
228
257
  - Gemfile
@@ -231,7 +260,7 @@ files:
231
260
  - Rakefile
232
261
  - ci/.gitignore
233
262
  - ci/README.md
234
- - ci/credentials.yml.tpl
263
+ - ci/credentials.yml.template
235
264
  - ci/docker-image/Dockerfile
236
265
  - ci/pipeline.yml
237
266
  - ci/tasks/run-int.sh
@@ -701,6 +730,8 @@ files:
701
730
  - test/integration/storage/test_files.rb
702
731
  - test/integration/storage/test_objects.rb
703
732
  - test/integration/test_authentication.rb
733
+ - test/unit/compute/test_common_collections.rb
734
+ - test/unit/compute/test_common_models.rb
704
735
  homepage: https://github.com/fog/fog-google
705
736
  licenses:
706
737
  - MIT
@@ -721,7 +752,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
721
752
  version: '0'
722
753
  requirements: []
723
754
  rubyforge_project:
724
- rubygems_version: 2.6.13
755
+ rubygems_version: 2.6.14
725
756
  signing_key:
726
757
  specification_version: 4
727
758
  summary: Module for the 'fog' gem to support Google.
@@ -779,3 +810,5 @@ test_files:
779
810
  - test/integration/storage/test_files.rb
780
811
  - test/integration/storage/test_objects.rb
781
812
  - test/integration/test_authentication.rb
813
+ - test/unit/compute/test_common_collections.rb
814
+ - test/unit/compute/test_common_models.rb
@@ -1,13 +0,0 @@
1
- ---
2
- # Google Cloud Platform project to run under
3
- google_project:
4
- # Google Compute Engine Service Account email
5
- google_client_email:
6
- # Google Compute Engine Service Account JSON
7
- google_json_key_data: |
8
-
9
- # An access token with repo:status access
10
- github_access_token:
11
- # A SSH private key associated with the access token's account or
12
- # a repo push deploy key
13
- github_private_key: |