fog-google 1.8.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.fog.example +1 -3
- data/.rubocop.yml +3 -3
- data/.travis.yml +5 -3
- data/CHANGELOG.md +126 -2
- data/CONTRIBUTING.md +0 -1
- data/README.md +59 -8
- data/SECURITY.md +16 -0
- data/ci/README.md +8 -8
- data/ci/build-head-pipeline.yml +173 -0
- data/ci/credentials.yml.template +0 -2
- data/ci/docker-image/Dockerfile +3 -3
- data/ci/{pipeline.yml → integration-pipeline.yml} +0 -33
- data/ci/pipeline-dev.yml +58 -0
- data/ci/tasks/run-int.sh +20 -3
- data/ci/tasks/run-int.yml +3 -1
- data/examples/sql/flags.rb +10 -6
- data/examples/sql/instances.rb +38 -34
- data/examples/sql/operations.rb +20 -16
- data/examples/sql/ssl_certs.rb +32 -28
- data/examples/sql/tiers.rb +10 -6
- data/fog-google.gemspec +3 -3
- data/lib/fog/compute/google.rb +5 -5
- data/lib/fog/compute/google/mock.rb +2 -1
- data/lib/fog/compute/google/models/address.rb +15 -2
- data/lib/fog/compute/google/models/disk.rb +6 -2
- data/lib/fog/compute/google/models/images.rb +6 -1
- data/lib/fog/compute/google/models/instance_groups.rb +2 -2
- data/lib/fog/compute/google/models/server.rb +33 -9
- data/lib/fog/compute/google/real.rb +2 -1
- data/lib/fog/compute/google/requests/abandon_instances.rb +2 -0
- data/lib/fog/compute/google/requests/add_backend_service_backends.rb +2 -0
- data/lib/fog/compute/google/requests/add_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/add_server_access_config.rb +2 -0
- data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -0
- data/lib/fog/compute/google/requests/attach_disk.rb +2 -0
- data/lib/fog/compute/google/requests/create_disk_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/delete_address.rb +2 -0
- data/lib/fog/compute/google/requests/delete_backend_service.rb +2 -0
- data/lib/fog/compute/google/requests/delete_disk.rb +2 -0
- data/lib/fog/compute/google/requests/delete_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/delete_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_operation.rb +2 -0
- data/lib/fog/compute/google/requests/delete_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/delete_image.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/delete_network.rb +2 -0
- data/lib/fog/compute/google/requests/delete_region_operation.rb +2 -0
- data/lib/fog/compute/google/requests/delete_route.rb +2 -0
- data/lib/fog/compute/google/requests/delete_server.rb +2 -0
- data/lib/fog/compute/google/requests/delete_server_access_config.rb +2 -0
- data/lib/fog/compute/google/requests/delete_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/delete_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/delete_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/delete_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/delete_zone_operation.rb +2 -0
- data/lib/fog/compute/google/requests/deprecate_image.rb +2 -0
- data/lib/fog/compute/google/requests/detach_disk.rb +2 -0
- data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +2 -0
- data/lib/fog/compute/google/requests/get_address.rb +2 -0
- data/lib/fog/compute/google/requests/get_backend_service_health.rb +2 -0
- data/lib/fog/compute/google/requests/get_disk.rb +2 -0
- data/lib/fog/compute/google/requests/get_disk_type.rb +2 -0
- data/lib/fog/compute/google/requests/get_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/get_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_operation.rb +2 -0
- data/lib/fog/compute/google/requests/get_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/get_image.rb +2 -0
- data/lib/fog/compute/google/requests/get_image_from_family.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/get_machine_type.rb +2 -0
- data/lib/fog/compute/google/requests/get_network.rb +2 -0
- data/lib/fog/compute/google/requests/get_project.rb +2 -0
- data/lib/fog/compute/google/requests/get_region.rb +2 -0
- data/lib/fog/compute/google/requests/get_route.rb +2 -0
- data/lib/fog/compute/google/requests/get_server.rb +2 -0
- data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -0
- data/lib/fog/compute/google/requests/get_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/get_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/get_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_pool_health.rb +2 -0
- data/lib/fog/compute/google/requests/get_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/get_zone.rb +2 -0
- data/lib/fog/compute/google/requests/get_zone_operation.rb +2 -0
- data/lib/fog/compute/google/requests/insert_address.rb +2 -0
- data/lib/fog/compute/google/requests/insert_backend_service.rb +2 -0
- data/lib/fog/compute/google/requests/insert_disk.rb +8 -5
- data/lib/fog/compute/google/requests/insert_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/insert_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/insert_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/insert_image.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/insert_network.rb +2 -0
- data/lib/fog/compute/google/requests/insert_route.rb +2 -0
- data/lib/fog/compute/google/requests/insert_server.rb +6 -0
- data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/insert_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/insert_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +2 -0
- data/lib/fog/compute/google/requests/list_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +2 -0
- data/lib/fog/compute/google/requests/list_disk_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_disks.rb +2 -0
- data/lib/fog/compute/google/requests/list_firewalls.rb +2 -0
- data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/list_images.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_groups.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_templates.rb +2 -0
- data/lib/fog/compute/google/requests/list_machine_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_networks.rb +2 -0
- data/lib/fog/compute/google/requests/list_region_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_regions.rb +2 -0
- data/lib/fog/compute/google/requests/list_routes.rb +2 -0
- data/lib/fog/compute/google/requests/list_servers.rb +2 -0
- data/lib/fog/compute/google/requests/list_snapshots.rb +2 -0
- data/lib/fog/compute/google/requests/list_ssl_certificates.rb +2 -0
- data/lib/fog/compute/google/requests/list_subnetworks.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_http_proxies.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_https_proxies.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_pools.rb +2 -0
- data/lib/fog/compute/google/requests/list_url_maps.rb +2 -0
- data/lib/fog/compute/google/requests/list_zone_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_zones.rb +2 -0
- data/lib/fog/compute/google/requests/patch_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/patch_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/recreate_instances.rb +2 -0
- data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -0
- data/lib/fog/compute/google/requests/reset_server.rb +2 -0
- data/lib/fog/compute/google/requests/reset_windows_password.rb +154 -0
- data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -0
- data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +2 -0
- data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +2 -0
- data/lib/fog/compute/google/requests/set_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_disk_auto_delete.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_machine_type.rb +23 -0
- data/lib/fog/compute/google/requests/set_server_metadata.rb +3 -1
- data/lib/fog/compute/google/requests/set_server_scheduling.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_tags.rb +2 -0
- data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -0
- data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -0
- data/lib/fog/compute/google/requests/start_server.rb +2 -0
- data/lib/fog/compute/google/requests/stop_server.rb +2 -0
- data/lib/fog/compute/google/requests/update_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/update_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/update_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/validate_url_map.rb +2 -0
- data/lib/fog/dns/google.rb +1 -1
- data/lib/fog/dns/google/requests/create_change.rb +2 -0
- data/lib/fog/dns/google/requests/create_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/delete_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/get_change.rb +2 -0
- data/lib/fog/dns/google/requests/get_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/get_project.rb +2 -0
- data/lib/fog/dns/google/requests/list_changes.rb +2 -0
- data/lib/fog/dns/google/requests/list_managed_zones.rb +2 -0
- data/lib/fog/dns/google/requests/list_resource_record_sets.rb +2 -0
- data/lib/fog/google/models/sql/ssl_cert.rb +7 -1
- data/lib/fog/google/models/sql/user.rb +2 -0
- data/lib/fog/google/monitoring.rb +2 -1
- data/lib/fog/google/pubsub.rb +1 -1
- data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/create_timeseries.rb +3 -1
- data/lib/fog/google/requests/monitoring/delete_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/get_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb +2 -0
- data/lib/fog/google/requests/monitoring/list_timeseries.rb +2 -0
- data/lib/fog/google/requests/pubsub/pull_subscription.rb +5 -1
- data/lib/fog/google/requests/sql/clone_instance.rb +2 -0
- data/lib/fog/google/requests/sql/delete_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/delete_instance.rb +2 -0
- data/lib/fog/google/requests/sql/delete_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/delete_user.rb +3 -1
- data/lib/fog/google/requests/sql/export_instance.rb +2 -0
- data/lib/fog/google/requests/sql/get_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/get_instance.rb +2 -0
- data/lib/fog/google/requests/sql/get_operation.rb +2 -0
- data/lib/fog/google/requests/sql/get_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/import_instance.rb +2 -0
- data/lib/fog/google/requests/sql/insert_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/insert_instance.rb +2 -0
- data/lib/fog/google/requests/sql/insert_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/insert_user.rb +2 -0
- data/lib/fog/google/requests/sql/list_backup_runs.rb +2 -0
- data/lib/fog/google/requests/sql/list_flags.rb +2 -0
- data/lib/fog/google/requests/sql/list_instances.rb +2 -0
- data/lib/fog/google/requests/sql/list_operations.rb +2 -0
- data/lib/fog/google/requests/sql/list_ssl_certs.rb +2 -0
- data/lib/fog/google/requests/sql/list_tiers.rb +2 -0
- data/lib/fog/google/requests/sql/list_users.rb +2 -0
- data/lib/fog/google/requests/sql/reset_instance_ssl_config.rb +2 -0
- data/lib/fog/google/requests/sql/restart_instance.rb +2 -0
- data/lib/fog/google/requests/sql/restore_instance_backup.rb +2 -0
- data/lib/fog/google/requests/sql/update_instance.rb +2 -0
- data/lib/fog/google/requests/sql/update_user.rb +2 -0
- data/lib/fog/google/shared.rb +115 -55
- data/lib/fog/google/sql.rb +1 -1
- data/lib/fog/google/version.rb +1 -1
- data/lib/fog/storage/google_json.rb +5 -1
- data/lib/fog/storage/google_json/mock.rb +6 -0
- data/lib/fog/storage/google_json/real.rb +106 -3
- data/lib/fog/storage/google_json/requests/copy_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/delete_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/delete_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object_metadata.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_buckets.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_object_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_objects.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_object_acl.rb +2 -0
- data/lib/fog/storage/google_json/utils.rb +1 -1
- data/lib/fog/storage/google_xml/models/file.rb +1 -1
- data/lib/fog/storage/google_xml/requests/get_bucket.rb +0 -1
- data/lib/fog/storage/google_xml/requests/head_object.rb +7 -6
- data/lib/fog/storage/google_xml/requests/put_bucket_acl.rb +2 -0
- data/tasks/changelog.rake +37 -0
- data/tasks/test.rake +6 -2
- data/test/helpers/integration_test_helper.rb +17 -6
- data/test/helpers/test_helper.rb +1 -0
- data/test/integration/compute/core_compute/test_servers.rb +40 -0
- data/test/integration/compute/core_compute/test_zones.rb +1 -1
- data/test/integration/compute/core_networking/test_addresses.rb +23 -0
- data/test/integration/factories/{sql_v1_certs_factory.rb → sql_certs_factory.rb} +3 -3
- data/test/integration/factories/{sql_v1_instances_factory.rb → sql_instances_factory.rb} +3 -3
- data/test/integration/factories/{sql_v1_users_factory.rb → sql_users_factory.rb} +6 -3
- data/test/integration/monitoring/test_metric_descriptors.rb +2 -0
- data/test/integration/monitoring/test_timeseries.rb +14 -26
- data/test/integration/pubsub/test_pubsub_models.rb +3 -3
- data/test/integration/pubsub/test_pubsub_requests.rb +2 -2
- data/test/integration/sql/{sqlv1/test_v1_certs.rb → test_certs.rb} +3 -3
- data/test/integration/sql/{sqlv1/test_common_flags.rb → test_common_flags.rb} +0 -0
- data/test/integration/sql/{sqlv1/test_common_tiers.rb → test_common_tiers.rb} +0 -0
- data/test/integration/sql/{sqlv1/test_coverage.rb → test_coverage.rb} +1 -1
- data/test/integration/sql/{sqlv2/test_v2_instances.rb → test_instances.rb} +22 -2
- data/test/integration/sql/{sqlv1/test_v1_users.rb → test_users.rb} +4 -4
- data/test/integration/test_authentication.rb +0 -7
- data/test/unit/storage/test_common_xml_collections.rb +11 -0
- data/test/unit/storage/test_json_requests.rb +0 -1
- metadata +50 -31
- data/test/integration/factories/sql_v2_instances_factory.rb +0 -19
- data/test/integration/sql/sqlv1/test_v1_instances.rb +0 -31
- data/test/integration/sql/sqlv2/test_coverage.rb +0 -6
@@ -27,7 +27,7 @@ module Fog
|
|
27
27
|
query = filtered.map { |k, v| [k.to_s, Fog::Google.escape(v)].join("=") }
|
28
28
|
end
|
29
29
|
|
30
|
-
query << "GoogleAccessId=#{
|
30
|
+
query << "GoogleAccessId=#{google_access_id}"
|
31
31
|
query << "Signature=#{CGI.escape(signature(params))}"
|
32
32
|
query << "Expires=#{params[:headers]['Date']}"
|
33
33
|
"#{params[:host]}/#{params[:path]}?#{query.join('&')}"
|
@@ -33,12 +33,13 @@ module Fog
|
|
33
33
|
headers["If-Modified-Since"] = Fog::Time.at(options["If-Modified-Since"].to_i).to_date_header if options["If-Modified-Since"]
|
34
34
|
headers["If-Unmodified-Since"] = Fog::Time.at(options["If-Unmodified-Since"].to_i).to_date_header if options["If-Modified-Since"]
|
35
35
|
headers.merge!(options)
|
36
|
-
request(:expects
|
37
|
-
:headers
|
38
|
-
:host
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
36
|
+
request(:expects => [200, 206],
|
37
|
+
:headers => headers,
|
38
|
+
:host => "#{bucket_name}.#{@host}",
|
39
|
+
:idempotent => true,
|
40
|
+
:method => "HEAD",
|
41
|
+
:path => Fog::Google.escape(object_name),
|
42
|
+
:query => query)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
# Helper method to insert text after a line that matches the regex
|
4
|
+
def insert_after_line(file, insert, regex = /^## Next/)
|
5
|
+
tempfile = File.open("#{file}.tmp", "w")
|
6
|
+
f = File.new(file)
|
7
|
+
f.each do |line|
|
8
|
+
tempfile << line
|
9
|
+
next unless line =~ regex
|
10
|
+
|
11
|
+
tempfile << "\n"
|
12
|
+
tempfile << insert
|
13
|
+
tempfile << "\n"
|
14
|
+
end
|
15
|
+
f.close
|
16
|
+
tempfile.close
|
17
|
+
|
18
|
+
FileUtils.mv("#{file}.tmp", file)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Extracts all changes that have been made after the latest pushed tag
|
22
|
+
def changes_since_last_tag
|
23
|
+
`git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%t - %s%n%b%n"`
|
24
|
+
end
|
25
|
+
|
26
|
+
# Extracts all github users contributed since last tag
|
27
|
+
def users_since_last_tag
|
28
|
+
`git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%s" | cut -d' ' -f 6 | cut -d/ -f1 | uniq`
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :changelog do
|
32
|
+
task :generate do
|
33
|
+
insert_after_line("CHANGELOG.md", changes_since_last_tag, /^## Next/)
|
34
|
+
printf("Users contributed since last release:\n")
|
35
|
+
printf(users_since_last_tag)
|
36
|
+
end
|
37
|
+
end
|
data/tasks/test.rake
CHANGED
@@ -86,10 +86,14 @@ namespace :test do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
desc "Run SQL API tests"
|
89
|
-
task :
|
89
|
+
task :sql => SQL_TEST_TASKS
|
90
90
|
|
91
91
|
desc "Run SQL API tests in parallel"
|
92
|
-
multitask :
|
92
|
+
multitask :sql_parallel => SQL_TEST_TASKS
|
93
|
+
|
94
|
+
# TODO(temikus): Remove after v1 is renamed in pipeline
|
95
|
+
desc "Run SQL API tests - v1 compat alias"
|
96
|
+
task :"sql-sqlv2" => :sql
|
93
97
|
|
94
98
|
Rake::TestTask.new do |t|
|
95
99
|
t.name = "sql"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
require "helpers/test_collection"
|
3
|
+
require "retriable"
|
3
4
|
|
4
5
|
# Use :test credentials in ~/.fog for live integration testing
|
5
6
|
# XXX not sure if this will work on Travis CI or not
|
@@ -22,13 +23,10 @@ TEST_IMAGE_FAMILY = "debian-9".freeze
|
|
22
23
|
|
23
24
|
# XXX This depends on a public image in gs://fog-test-bucket; there may be a better way to do this
|
24
25
|
# The image was created like so: https://cloud.google.com/compute/docs/images#export_an_image_to_google_cloud_storage
|
25
|
-
TEST_RAW_DISK_SOURCE = "
|
26
|
+
TEST_RAW_DISK_SOURCE = "https://storage.googleapis.com/fog-testing-bucket/fog-test-raw-disk-source.image.tar.gz".freeze
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
TEST_SQL_TIER_SECOND = "db-n1-standard-1".freeze
|
31
|
-
TEST_SQL_REGION_SECOND = TEST_REGION
|
28
|
+
TEST_SQL_TIER = "db-n1-standard-1".freeze
|
29
|
+
TEST_SQL_REGION = TEST_REGION
|
32
30
|
|
33
31
|
# Test certificate/key for SSL Proxy tests, generated via:
|
34
32
|
# $ openssl genrsa -out example.key 2048
|
@@ -90,8 +88,21 @@ wLjafhPTSAIS0jijglJ7uzaSbFUW11fw1/EIqIFNe0R0Xf9lsyPxFA==
|
|
90
88
|
-----END RSA PRIVATE KEY-----
|
91
89
|
KEY
|
92
90
|
|
91
|
+
# Retry module config - standard retriable gem settings
|
92
|
+
# see: https://github.com/kamui/retriable
|
93
|
+
RETRIABLE_TRIES = 3
|
94
|
+
RETRIABLE_BASE_INTERVAL = 50
|
95
|
+
|
93
96
|
class FogIntegrationTest < MiniTest::Test
|
94
97
|
def namespaced_name
|
95
98
|
"#{self.class}_#{name}"
|
96
99
|
end
|
100
|
+
|
101
|
+
def retry_on(klass)
|
102
|
+
Retriable.retriable(on: klass,
|
103
|
+
tries: RETRIABLE_TRIES,
|
104
|
+
base_interval: RETRIABLE_BASE_INTERVAL) do
|
105
|
+
yield
|
106
|
+
end
|
107
|
+
end
|
97
108
|
end
|
data/test/helpers/test_helper.rb
CHANGED
@@ -20,6 +20,22 @@ class TestServers < FogIntegrationTest
|
|
20
20
|
super
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_set_machine_type
|
24
|
+
server = @factory.create
|
25
|
+
server.stop
|
26
|
+
server.wait_for { stopped? }
|
27
|
+
server.set_machine_type("n1-standard-2", false)
|
28
|
+
assert_equal "n1-standard-2", server.machine_type.split("/")[-1]
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_set_machine_type_fail
|
32
|
+
server = @factory.create
|
33
|
+
server.wait_for { ready? }
|
34
|
+
assert_raises Fog::Errors::Error do
|
35
|
+
server.set_machine_type("n1-standard-2", false)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
def test_set_metadata
|
24
40
|
server = @factory.create
|
25
41
|
server.wait_for { ready? }
|
@@ -28,6 +44,15 @@ class TestServers < FogIntegrationTest
|
|
28
44
|
{ :key => "baz", :value => "foo" }], server.metadata[:items]
|
29
45
|
end
|
30
46
|
|
47
|
+
def test_add_ssh_key
|
48
|
+
key = "ssh-rsa IAMNOTAREALSSHKEYAMA=="
|
49
|
+
username = "test_user"
|
50
|
+
server = @factory.create
|
51
|
+
server.add_ssh_key(username, key, false)
|
52
|
+
assert_equal [{ :key => "ssh-keys",
|
53
|
+
:value => "test_user:ssh-rsa IAMNOTAREALSSHKEYAMA== test_user" }], server.metadata[:items]
|
54
|
+
end
|
55
|
+
|
31
56
|
def test_bootstrap
|
32
57
|
key = "ssh-rsa IAMNOTAREALSSHKEYAMA== user@host.subdomain.example.com"
|
33
58
|
user = "username"
|
@@ -106,4 +131,19 @@ class TestServers < FogIntegrationTest
|
|
106
131
|
|
107
132
|
assert server.ready?
|
108
133
|
end
|
134
|
+
|
135
|
+
def test_reset_windows_password
|
136
|
+
win_disk = @disks.create(
|
137
|
+
:name => "fog-test-1-testservers-test-reset-windows-password-2",
|
138
|
+
:source_image => "windows-server-1909-dc-core-v20200310",
|
139
|
+
:size_gb => 32
|
140
|
+
)
|
141
|
+
server = @factory.create(:disks => [win_disk])
|
142
|
+
server.wait_for { ready? }
|
143
|
+
server.reset_windows_password("test_user")
|
144
|
+
serial_output = server.serial_port_output(:port => 4)
|
145
|
+
|
146
|
+
assert_includes(serial_output, "encryptedPassword")
|
147
|
+
assert_includes(serial_output, "\"userName\":\"test_user\"")
|
148
|
+
end
|
109
149
|
end
|
@@ -20,7 +20,7 @@ class TestZones < FogIntegrationTest
|
|
20
20
|
# This tests only in last zone since not all zones contain all machine types
|
21
21
|
ZONES.each do |name|
|
22
22
|
zone = @subject.get(name)
|
23
|
-
refute_nil(zone, "zones.get() should not return nil")
|
23
|
+
refute_nil(zone, "zones.get(#{name}) should not return nil")
|
24
24
|
assert(zone.up?, "zones.up? should return up, unless there's an outage")
|
25
25
|
end
|
26
26
|
end
|
@@ -32,6 +32,29 @@ class TestAddresses < FogIntegrationTest
|
|
32
32
|
@subject.get(address.name, TEST_REGION).status,
|
33
33
|
"Address should now be in use"
|
34
34
|
)
|
35
|
+
|
36
|
+
address.reload
|
37
|
+
|
38
|
+
assert_equal(
|
39
|
+
server,
|
40
|
+
address.server,
|
41
|
+
"Address.server should return an associated server object"
|
42
|
+
)
|
43
|
+
|
44
|
+
address.server = nil
|
45
|
+
address.reload
|
46
|
+
assert_nil(
|
47
|
+
address.server,
|
48
|
+
"Address should not be associated with a server after disassociation"
|
49
|
+
)
|
50
|
+
|
51
|
+
address.server = server
|
52
|
+
address.reload
|
53
|
+
assert_equal(
|
54
|
+
server,
|
55
|
+
address.server,
|
56
|
+
"Address should be associated with a server after association"
|
57
|
+
)
|
35
58
|
end
|
36
59
|
|
37
60
|
def test_bad_get
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "integration/factories/collection_factory"
|
2
|
-
require "integration/factories/
|
2
|
+
require "integration/factories/sql_instances_factory"
|
3
3
|
|
4
|
-
class
|
4
|
+
class SqlCertsFactory < CollectionFactory
|
5
5
|
def initialize(example)
|
6
|
-
@instances =
|
6
|
+
@instances = SqlInstancesFactory.new(example)
|
7
7
|
super(Fog::Google[:sql].ssl_certs, example)
|
8
8
|
end
|
9
9
|
|