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.
- 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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
|
|
3
|
+
# This is a simple coverage helper that helps differentiate
|
|
4
|
+
# the tests when run in parallel so the final coverage report
|
|
5
|
+
# can be properly combined together from multiple runners
|
|
6
|
+
SimpleCov.command_name "test:compute-core_networking" if ENV["COVERAGE"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/firewalls_factory"
|
|
3
|
+
|
|
4
|
+
class TestFirewalls < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].firewalls
|
|
9
|
+
@factory = FirewallsFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/networks_factory"
|
|
3
|
+
require "integration/factories/servers_factory"
|
|
4
|
+
|
|
5
|
+
class TestNetworks < FogIntegrationTest
|
|
6
|
+
include TestCollection
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@subject = Fog::Compute[:google].networks
|
|
10
|
+
@servers = ServersFactory.new(namespaced_name)
|
|
11
|
+
@factory = NetworksFactory.new(namespaced_name)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def teardown
|
|
15
|
+
# Clean up the server resources used in testing
|
|
16
|
+
@servers.cleanup
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_valid_range
|
|
21
|
+
network = @factory.create
|
|
22
|
+
|
|
23
|
+
octet = /\d{,2}|1\d{2}|2[0-4]\d|25[0-5]/
|
|
24
|
+
netmask = /(\d{1}|1[0-9]|2[0-9]|3[0-2])/
|
|
25
|
+
re = /\A#{octet}\.#{octet}\.#{octet}\.#{octet}\/#{netmask}\z/
|
|
26
|
+
|
|
27
|
+
assert_match(re, network.ipv4_range,
|
|
28
|
+
"Network range should be valid")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_run_instance
|
|
32
|
+
network = @factory.create
|
|
33
|
+
server = @servers.create(:network_interfaces => [network.get_as_interface_config])
|
|
34
|
+
|
|
35
|
+
assert_equal(
|
|
36
|
+
network.self_link,
|
|
37
|
+
server.network_interfaces[0][:network],
|
|
38
|
+
"Created server should have the network specified on boot"
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
|
|
3
|
+
class TestRoutes < FogIntegrationTest
|
|
4
|
+
def setup
|
|
5
|
+
@subject = Fog::Compute[:google].routes
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_all
|
|
9
|
+
assert_operator(@subject.all.size, :>=, 2,
|
|
10
|
+
"Number of all routes should be greater or equal than 2 - default GW and default routes")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_get
|
|
14
|
+
@subject.all do |route|
|
|
15
|
+
refute_nil @subject.get(route.name)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_bad_get
|
|
20
|
+
assert_nil @subject.get("bad-name")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_enumerable
|
|
24
|
+
assert_respond_to @subject, :each
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/subnetworks_factory"
|
|
3
|
+
|
|
4
|
+
class TestSubnetworks < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].subnetworks
|
|
9
|
+
@factory = SubnetworksFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
|
|
3
|
+
# This is a simple coverage helper that helps differentiate
|
|
4
|
+
# the tests when run in parallel so the final coverage report
|
|
5
|
+
# can be properly combined together from multiple runners
|
|
6
|
+
SimpleCov.command_name "test:compute-instance_groups" if ENV["COVERAGE"]
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/instance_groups_factory"
|
|
3
|
+
|
|
4
|
+
class TestInstanceGroups < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].instance_groups
|
|
9
|
+
@factory = InstanceGroupsFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
File without changes
|
data/test/integration/compute/{test_backend_services.rb → loadbalancing/test_backend_services.rb}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
|
|
3
|
+
# This is a simple coverage helper that helps differentiate
|
|
4
|
+
# the tests when run in parallel so the final coverage report
|
|
5
|
+
# can be properly combined together from multiple runners
|
|
6
|
+
SimpleCov.command_name "test:compute-loadbalancing" if ENV["COVERAGE"]
|
data/test/integration/compute/{test_forwarding_rules.rb → loadbalancing/test_forwarding_rules.rb}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/global_addresses_factory"
|
|
3
|
+
|
|
4
|
+
class TestGlobalAddresses < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].global_addresses
|
|
9
|
+
@factory = GlobalAddressesFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/ssl_certificates_factory"
|
|
3
|
+
|
|
4
|
+
class TestSslCertificates < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].ssl_certificates
|
|
9
|
+
@factory = SslCertificatesFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "helpers/integration_test_helper"
|
|
2
|
+
require "integration/factories/target_https_proxies_factory"
|
|
3
|
+
|
|
4
|
+
class TestTargetHttpsProxies < FogIntegrationTest
|
|
5
|
+
include TestCollection
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Fog::Compute[:google].target_https_proxies
|
|
9
|
+
@factory = TargetHttpsProxiesFactory.new(namespaced_name)
|
|
10
|
+
end
|
|
11
|
+
end
|
data/test/integration/compute/{test_target_instances.rb → loadbalancing/test_target_instances.rb}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
# XXX This is not partucularly elegant but if the instance doesn't respond
|
|
24
|
+
# to the healthcheck at all (for example there's nothing listening) it'll
|
|
25
|
+
# enter "No instance health info was found." state, during which the API
|
|
26
|
+
# will return an empty health object instead of UNHEALTHY.
|
|
27
|
+
# To avoid setting up a brittle environment with a live healthcheck we just
|
|
28
|
+
# stop the instance so health check returns UNHEALTHY and we can test that
|
|
29
|
+
# all fields are returned correctly.
|
|
30
|
+
server.stop
|
|
31
|
+
server.wait_for { stopped? }
|
|
32
|
+
|
|
33
|
+
# There's no way to track the readiness of the instance resource in a target pool,
|
|
34
|
+
# so wrapping in a soft retry:
|
|
35
|
+
begin
|
|
36
|
+
retries ||= 0
|
|
37
|
+
target_pool.get_health
|
|
38
|
+
rescue ::Google::Apis::ClientError
|
|
39
|
+
sleep 25
|
|
40
|
+
retry if (retries += 1) < 3
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
refute_empty(target_pool.health_checks, "Target pool should have a health check")
|
|
44
|
+
assert_equal(2, target_pool.instances.count, "Target pool should have 2 instances")
|
|
45
|
+
assert_equal([{ :health_state => "UNHEALTHY",
|
|
46
|
+
:instance => server.self_link }],
|
|
47
|
+
target_pool.get_health[server.self_link],
|
|
48
|
+
"Target pool should return a proper health check list")
|
|
49
|
+
assert_equal({ server.self_link =>
|
|
50
|
+
[{ :health_state => "UNHEALTHY",
|
|
51
|
+
:instance => server.self_link }] },
|
|
52
|
+
target_pool.get_health(server.name),
|
|
53
|
+
"target_pool should return instance health details when an instance is specified")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class AddressesFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
super(Fog::Compute[:google].addresses, example)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get(identity)
|
|
9
|
+
@subject.get(identity, TEST_REGION)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def params
|
|
13
|
+
{ :name => resource_name,
|
|
14
|
+
:region => TEST_REGION }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -7,14 +7,35 @@ class CollectionFactory
|
|
|
7
7
|
@resource_counter = 0
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
# Cleans up all objects created by the factory in the current test suite.
|
|
11
|
+
#
|
|
12
|
+
# @param async [FalseClass or TrueClass] perform resource destruction asynchronously
|
|
10
13
|
def cleanup(async = false)
|
|
11
|
-
|
|
14
|
+
suit_name = @example.gsub(/\W/, "").tr("_", "-").downcase.split('-')[0]
|
|
15
|
+
resources = @subject.all.select { |resource| resource.name.match /#{PREFIX}-[0-9]*-#{suit_name}/ }
|
|
16
|
+
if DEBUG
|
|
17
|
+
p "Cleanup invoked in #{self} for example: #{@example}"
|
|
18
|
+
p "Resources to be deleted: #{resources.map { |r| r.name }}"
|
|
19
|
+
p "All subject resources: #{@subject.all.map { |s| s.name }}"
|
|
20
|
+
end
|
|
12
21
|
resources.each { |r| r.destroy(async) }
|
|
13
22
|
resources.each { |r| Fog.wait_for { !@subject.all.map(&:identity).include? r.identity } }
|
|
14
23
|
end
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
# Creates a collection object instance e.g. Fog::Compute::Google::Server
|
|
26
|
+
#
|
|
27
|
+
# @param custom_params [Hash] override factory creation parameters or provide
|
|
28
|
+
# additional ones. Useful in tests where you need to create a slightly different
|
|
29
|
+
# resource than the default one but still want to take advantage of the factory's
|
|
30
|
+
# cleanup methods, etc.
|
|
31
|
+
#
|
|
32
|
+
# @example Create a custom factory
|
|
33
|
+
# @factory = ServersFactory.new(namespaced_name)
|
|
34
|
+
# server = @factory.create(:machine_type => "f1-micro")
|
|
35
|
+
#
|
|
36
|
+
# @return [Object] collection object instance
|
|
37
|
+
def create(custom_params = {})
|
|
38
|
+
@subject.create(params.merge(custom_params))
|
|
18
39
|
end
|
|
19
40
|
|
|
20
41
|
def get(identity)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class FirewallsFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
super(Fog::Compute[:google].firewalls, example)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def params
|
|
9
|
+
{ :name => resource_name,
|
|
10
|
+
:allowed => [{ :ip_protocol => "TCP",
|
|
11
|
+
:ports => ["201"] }] }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class GlobalAddressesFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
super(Fog::Compute[:google].global_addresses, example)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get(identity)
|
|
9
|
+
@subject.get(identity)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def params
|
|
13
|
+
{ :name => resource_name }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class InstanceGroupsFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
super(Fog::Compute[:google].instance_groups, example)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get(identity)
|
|
9
|
+
@subject.get(identity, TEST_ZONE)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def params
|
|
13
|
+
{ :name => resource_name,
|
|
14
|
+
:zone => TEST_ZONE }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -13,6 +13,7 @@ class InstanceTemplateFactory < CollectionFactory
|
|
|
13
13
|
:machine_type => TEST_MACHINE_TYPE,
|
|
14
14
|
:disks => [{
|
|
15
15
|
:boot => true,
|
|
16
|
+
:auto_delete => true,
|
|
16
17
|
:initialize_params =>
|
|
17
18
|
{ :source_image => "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20180522" }
|
|
18
19
|
}],
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class NetworksFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
# We cannot have 2 networks with the same IP range so instantiating a
|
|
6
|
+
# class variable holding a generator, ensuring that the factory gives
|
|
7
|
+
# us a new network every time it's called
|
|
8
|
+
@octet_generator = (0..255).each
|
|
9
|
+
super(Fog::Compute[:google].networks, example)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def params
|
|
13
|
+
{ :name => resource_name,
|
|
14
|
+
:ipv4_range => "172.16.#{@octet_generator.next}.0/24" }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class SslCertificatesFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
super(Fog::Compute[:google].ssl_certificates, example)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def params
|
|
9
|
+
{ :name => resource_name,
|
|
10
|
+
:certificate => TEST_PEM_CERTIFICATE,
|
|
11
|
+
:private_key => TEST_PEM_CERTIFICATE_PRIVATE_KEY }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
|
|
3
|
+
class SubnetworksFactory < CollectionFactory
|
|
4
|
+
def initialize(example)
|
|
5
|
+
# We cannot have 2 subnetworks with the same CIDR range so instantiating a
|
|
6
|
+
# class variable holding a generator, ensuring that the factory gives us a
|
|
7
|
+
# new subnet every time it's called
|
|
8
|
+
@octet_generator = (0..255).each
|
|
9
|
+
super(Fog::Compute[:google].subnetworks, example)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get(identity)
|
|
13
|
+
@subject.get(identity, TEST_REGION)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def params
|
|
17
|
+
{ :name => resource_name,
|
|
18
|
+
:network => "default",
|
|
19
|
+
:region => TEST_REGION,
|
|
20
|
+
:ip_cidr_range => "192.168.#{@octet_generator.next}.0/24" }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "integration/factories/collection_factory"
|
|
2
|
+
require "integration/factories/url_maps_factory"
|
|
3
|
+
require "integration/factories/ssl_certificates_factory"
|
|
4
|
+
|
|
5
|
+
class TargetHttpsProxiesFactory < CollectionFactory
|
|
6
|
+
def initialize(example)
|
|
7
|
+
@ssl_certificates = SslCertificatesFactory.new(example)
|
|
8
|
+
@url_maps = UrlMapsFactory.new(example)
|
|
9
|
+
super(Fog::Compute[:google].target_https_proxies, example)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def cleanup
|
|
13
|
+
# Calling CollectionFactory#cleanup with forced async as
|
|
14
|
+
# Url Maps need the Https Proxy to be deleted before they
|
|
15
|
+
# can be destroyed
|
|
16
|
+
super(false)
|
|
17
|
+
@ssl_certificates.cleanup
|
|
18
|
+
@url_maps.cleanup
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def params
|
|
22
|
+
{ :name => resource_name,
|
|
23
|
+
:url_map => @url_maps.create.self_link,
|
|
24
|
+
:ssl_certificates => [@ssl_certificates.create.self_link] }
|
|
25
|
+
end
|
|
26
|
+
end
|