fog-google 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,54 +0,0 @@
1
- require "helpers/integration_test_helper"
2
- require "integration/factories/servers_factory"
3
-
4
- class TestServers < FogIntegrationTest
5
- include TestCollection
6
-
7
- # Cleanup is handled by TestCollection
8
- def setup
9
- @subject = Fog::Compute[:google].servers
10
- @factory = ServersFactory.new(namespaced_name)
11
- end
12
-
13
- def test_set_metadata
14
- server = @factory.create
15
- server.wait_for { ready? }
16
- server.set_metadata({ "foo" => "bar", "baz" => "foo" }, false)
17
- assert_equal [{ :key => "foo", :value => "bar" },
18
- { :key => "baz", :value => "foo" }], server.metadata[:items]
19
- end
20
-
21
- def test_bootstrap
22
- key = "ssh-rsa IAMNOTAREALSSHKEYAMA== user@host.subdomain.example.com"
23
- user = "username"
24
-
25
- File.stub :read, key do
26
- # Name is set this way so it will be cleaned up by CollectionFactory
27
- # Public_key_path is set to avoid stubbing out File.exist?
28
- server = @subject.bootstrap(:name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
29
- :username => user,
30
- :public_key_path => "foo")
31
- boot_disk = server.disks.detect { |disk| disk[:boot] }
32
-
33
- assert_equal("RUNNING", server.status, "Bootstrapped server should be running")
34
- assert_equal(key, server.public_key, "Bootstrapped server should have a public key set")
35
- assert_equal(user, server.username, "Bootstrapped server should have user set to #{user}")
36
- assert(boot_disk[:auto_delete], "Bootstrapped server should have disk set to autodelete")
37
-
38
- network_adapter = server.network_interfaces.detect { |x| x.has_key?(:access_configs) }
39
-
40
- refute_nil(network_adapter[:access_configs].detect { |x| x[:nat_ip] },
41
- "Bootstrapped server should have an external ip by default")
42
- end
43
- end
44
-
45
- def test_bootstrap_fail
46
- # Pretend the ssh key does not exist
47
- File.stub :exist?, nil do
48
- assert_raises(Fog::Errors::Error) {
49
- @subject.bootstrap(:name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
50
- :public_key_path => nil)
51
- }
52
- end
53
- end
54
- end
@@ -1,38 +0,0 @@
1
- require "helpers/integration_test_helper"
2
- require "integration/factories/target_pools_factory"
3
-
4
- class TestTargetPools < FogIntegrationTest
5
- include TestCollection
6
-
7
- def setup
8
- @subject = Fog::Compute[:google].target_pools
9
- @factory = TargetPoolsFactory.new(namespaced_name)
10
- @servers = Fog::Compute[:google].servers
11
- end
12
-
13
- # Override to include zone in get request
14
- def get_resource(identity)
15
- @subject.get(identity, TEST_ZONE)
16
- end
17
-
18
- def test_get_health
19
- target_pool = @factory.create
20
- server = @servers.get(target_pool.instances[0].split("/").last)
21
- server.wait_for { ready? }
22
-
23
- # There's no way to track the readiness of the instance resource in a target pool,
24
- # so wrapping in a soft retry:
25
- begin
26
- retries ||= 0
27
- target_pool.get_health
28
- rescue ::Google::Apis::ClientError
29
- sleep 25
30
- retry if (retries += 1) < 3
31
- end
32
-
33
- assert_equal(target_pool.get_health[server.self_link][0][:instance], server.self_link,
34
- "target_pool should return instance health details")
35
- assert_equal(target_pool.get_health(server.name)[server.self_link][0][:instance], server.self_link,
36
- "target_pool should return instance health details when an instance is specified")
37
- end
38
- end