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.
- checksums.yaml +5 -5
- data/.codecov.yml +2 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +51 -0
- data/CONTRIBUTING.md +85 -17
- data/CONTRIBUTORS.md +6 -4
- data/Gemfile +6 -0
- data/MIGRATING.md +1 -11
- data/README.md +15 -4
- data/ci/credentials.yml.template +2 -0
- data/ci/docker-image/Dockerfile +1 -3
- data/ci/pipeline.yml +117 -12
- data/ci/tasks/run-int.sh +3 -2
- data/ci/tasks/run-int.yml +1 -1
- data/examples/create_instance.rb +40 -25
- data/examples/get_list_images.rb +1 -1
- data/examples/load-balance.rb +1 -1
- data/examples/metadata.rb +1 -1
- data/examples/network.rb +1 -1
- data/fog-google.gemspec +8 -6
- data/lib/fog/compute/google/models/address.rb +1 -1
- data/lib/fog/compute/google/models/backend_service.rb +1 -1
- data/lib/fog/compute/google/models/disk.rb +2 -2
- data/lib/fog/compute/google/models/firewall.rb +23 -3
- data/lib/fog/compute/google/models/forwarding_rule.rb +1 -1
- data/lib/fog/compute/google/models/global_address.rb +1 -1
- data/lib/fog/compute/google/models/global_forwarding_rule.rb +1 -1
- data/lib/fog/compute/google/models/http_health_check.rb +2 -2
- data/lib/fog/compute/google/models/image.rb +1 -1
- data/lib/fog/compute/google/models/instance_group_manager.rb +1 -1
- data/lib/fog/compute/google/models/instance_template.rb +1 -1
- data/lib/fog/compute/google/models/route.rb +1 -1
- data/lib/fog/compute/google/models/server.rb +59 -5
- data/lib/fog/compute/google/models/servers.rb +1 -1
- data/lib/fog/compute/google/models/ssl_certificate.rb +1 -1
- data/lib/fog/compute/google/models/subnetwork.rb +1 -1
- data/lib/fog/compute/google/models/target_http_proxy.rb +1 -1
- data/lib/fog/compute/google/models/target_https_proxy.rb +14 -1
- data/lib/fog/compute/google/models/target_instance.rb +1 -1
- data/lib/fog/compute/google/models/target_pool.rb +1 -1
- data/lib/fog/compute/google/models/url_map.rb +1 -1
- data/lib/fog/compute/google/requests/insert_server.rb +1 -1
- data/lib/fog/dns/google/models/record.rb +1 -1
- data/lib/fog/google/models/sql/instance.rb +1 -1
- data/lib/fog/google/models/sql/user.rb +1 -1
- data/lib/fog/google/version.rb +1 -1
- data/lib/fog/storage/google_json.rb +4 -1
- data/lib/fog/storage/google_json/mock.rb +3 -0
- data/lib/fog/storage/google_json/models/file.rb +2 -2
- data/lib/fog/storage/google_json/models/files.rb +2 -2
- data/lib/fog/storage/google_json/real.rb +3 -0
- data/lib/fog/storage/google_json/requests/get_object_http_url.rb +6 -7
- data/lib/fog/storage/google_json/requests/get_object_https_url.rb +6 -7
- data/lib/fog/storage/google_json/requests/get_object_url.rb +4 -4
- data/lib/fog/storage/google_json/utils.rb +7 -1
- data/lib/fog/storage/google_xml/models/file.rb +2 -2
- data/lib/fog/storage/google_xml/models/files.rb +4 -4
- data/lib/fog/storage/google_xml/requests/get_object_http_url.rb +8 -7
- data/lib/fog/storage/google_xml/requests/get_object_https_url.rb +7 -7
- data/lib/fog/storage/google_xml/requests/get_object_url.rb +5 -4
- data/lib/fog/storage/google_xml/utils.rb +7 -1
- data/tasks/test.rake +45 -23
- data/test/helpers/integration_test_helper.rb +67 -0
- data/test/helpers/test_helper.rb +14 -10
- data/test/integration/compute/core_compute/test_coverage.rb +6 -0
- data/test/integration/compute/{test_disk_types.rb → core_compute/test_disk_types.rb} +0 -0
- data/test/integration/compute/{disks/test_compute_disk_models.rb → core_compute/test_disks.rb} +0 -0
- data/test/integration/compute/{test_images.rb → core_compute/test_images.rb} +0 -0
- data/test/integration/compute/core_compute/test_machine_types.rb +42 -0
- data/test/integration/compute/core_compute/test_operations.rb +27 -0
- data/test/integration/compute/core_compute/test_projects.rb +19 -0
- data/test/integration/compute/{test_regions.rb → core_compute/test_regions.rb} +0 -0
- data/test/integration/compute/core_compute/test_servers.rb +109 -0
- data/test/integration/compute/{test_snapshots.rb → core_compute/test_snapshots.rb} +0 -0
- data/test/integration/compute/core_compute/test_zones.rb +35 -0
- data/test/integration/compute/core_networking/test_addresses.rb +84 -0
- data/test/integration/compute/core_networking/test_coverage.rb +6 -0
- data/test/integration/compute/core_networking/test_firewalls.rb +11 -0
- data/test/integration/compute/core_networking/test_networks.rb +41 -0
- data/test/integration/compute/core_networking/test_routes.rb +26 -0
- data/test/integration/compute/core_networking/test_subnetworks.rb +11 -0
- data/test/integration/compute/instance_groups/test_coverage.rb +6 -0
- data/test/integration/compute/{test_instance_group_managers.rb → instance_groups/test_instance_group_managers.rb} +0 -0
- data/test/integration/compute/instance_groups/test_instance_groups.rb +11 -0
- data/test/integration/compute/{test_instance_templates.rb → instance_groups/test_instance_templates.rb} +0 -0
- data/test/integration/compute/{test_backend_services.rb → loadbalancing/test_backend_services.rb} +0 -0
- data/test/integration/compute/loadbalancing/test_coverage.rb +6 -0
- data/test/integration/compute/{test_forwarding_rules.rb → loadbalancing/test_forwarding_rules.rb} +0 -0
- data/test/integration/compute/loadbalancing/test_global_addresses.rb +11 -0
- data/test/integration/compute/{test_global_forwarding_rules.rb → loadbalancing/test_global_forwarding_rules.rb} +0 -0
- data/test/integration/compute/{test_http_health_checks.rb → loadbalancing/test_http_health_checks.rb} +0 -0
- data/test/integration/compute/loadbalancing/test_ssl_certificates.rb +11 -0
- data/test/integration/compute/{test_target_http_proxies.rb → loadbalancing/test_target_http_proxies.rb} +0 -0
- data/test/integration/compute/loadbalancing/test_target_https_proxies.rb +11 -0
- data/test/integration/compute/{test_target_instances.rb → loadbalancing/test_target_instances.rb} +0 -0
- data/test/integration/compute/loadbalancing/test_target_pools.rb +55 -0
- data/test/integration/compute/{test_url_maps.rb → loadbalancing/test_url_maps.rb} +0 -0
- data/test/integration/factories/addresses_factory.rb +16 -0
- data/test/integration/factories/collection_factory.rb +24 -3
- data/test/integration/factories/disks_factory.rb +1 -0
- data/test/integration/factories/firewalls_factory.rb +13 -0
- data/test/integration/factories/global_addresses_factory.rb +15 -0
- data/test/integration/factories/instance_groups_factory.rb +16 -0
- data/test/integration/factories/instance_template_factory.rb +1 -0
- data/test/integration/factories/networks_factory.rb +16 -0
- data/test/integration/factories/ssl_certificates_factory.rb +13 -0
- data/test/integration/factories/subnetworks_factory.rb +22 -0
- data/test/integration/factories/target_https_proxies_factory.rb +26 -0
- data/test/integration/factories/target_pools_factory.rb +2 -2
- data/test/integration/monitoring/test_coverage.rb +6 -0
- data/test/integration/monitoring/test_timeseries.rb +1 -1
- data/test/integration/pubsub/test_coverage.rb +6 -0
- data/test/integration/sql/{test_common_flags.rb → sqlv1/test_common_flags.rb} +0 -0
- data/test/integration/sql/{test_common_tiers.rb → sqlv1/test_common_tiers.rb} +0 -0
- data/test/integration/sql/sqlv1/test_coverage.rb +6 -0
- data/test/integration/sql/{test_v1_certs.rb → sqlv1/test_v1_certs.rb} +0 -0
- data/test/integration/sql/{test_v1_instances.rb → sqlv1/test_v1_instances.rb} +0 -0
- data/test/integration/sql/{test_v1_users.rb → sqlv1/test_v1_users.rb} +0 -0
- data/test/integration/sql/sqlv2/test_coverage.rb +6 -0
- data/test/integration/sql/{test_v2_instances.rb → sqlv2/test_v2_instances.rb} +0 -0
- data/test/integration/storage/test_coverage.rb +6 -0
- data/test/unit/storage/test_json_requests.rb +45 -0
- data/test/unit/storage/test_xml_requests.rb +20 -0
- metadata +115 -92
- data/test/integration/compute/addresses/addresses_shared.rb +0 -59
- data/test/integration/compute/addresses/test_compute_address_models.rb +0 -105
- data/test/integration/compute/addresses/test_compute_address_requests.rb +0 -52
- data/test/integration/compute/disks/test_compute_disk_requests.rb +0 -92
- data/test/integration/compute/test_compute_addresses_collection.rb +0 -75
- data/test/integration/compute/test_compute_networks_collection.rb +0 -69
- data/test/integration/compute/test_servers.rb +0 -54
- 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
|