From 7b22e82fda081647ce5087168a1a9247eebe0243 Mon Sep 17 00:00:00 2001 From: Nathan McKinley Date: Fri, 7 Sep 2018 01:24:17 +0000 Subject: [PATCH] Add VCR-based integration / unit tests. --- .fixtures.yml | 33 ++++++ CONTRIBUTING.md | 29 +++++ Gemfile | 7 +- Gemfile.lock | 54 +++++++++ Rakefile | 1 + spec/fixtures/mock_hc_fn.pp | 30 +++++ spec/gcompute_address_provider_spec.rb | 5 + spec/gcompute_backend_bucket_provider_spec.rb | 5 + .../gcompute_backend_service_provider_spec.rb | 5 + spec/gcompute_disk_provider_spec.rb | 5 + spec/gcompute_disk_type_provider_spec.rb | 5 + spec/gcompute_firewall_provider_spec.rb | 5 + .../gcompute_forwarding_rule_provider_spec.rb | 5 + spec/gcompute_global_address_provider_spec.rb | 5 + ...te_global_forwarding_rule_provider_spec.rb | 5 + spec/gcompute_health_check_provider_spec.rb | 5 + ...compute_http_health_check_provider_spec.rb | 5 + ...ompute_https_health_check_provider_spec.rb | 5 + spec/gcompute_image_provider_spec.rb | 5 + ...te_instance_group_manager_provider_spec.rb | 5 + spec/gcompute_instance_group_provider_spec.rb | 5 + spec/gcompute_instance_provider_spec.rb | 5 + ...compute_instance_template_provider_spec.rb | 5 + spec/gcompute_license_provider_spec.rb | 5 + spec/gcompute_machine_type_provider_spec.rb | 5 + spec/gcompute_network_provider_spec.rb | 5 + spec/gcompute_region_provider_spec.rb | 5 + spec/gcompute_route_provider_spec.rb | 5 + spec/gcompute_router_provider_spec.rb | 5 + spec/gcompute_snapshot_provider_spec.rb | 5 + .../gcompute_ssl_certificate_provider_spec.rb | 5 + spec/gcompute_subnetwork_provider_spec.rb | 5 + ...compute_target_http_proxy_provider_spec.rb | 5 + ...ompute_target_https_proxy_provider_spec.rb | 5 + spec/gcompute_target_pool_provider_spec.rb | 5 + ...gcompute_target_ssl_proxy_provider_spec.rb | 5 + ...gcompute_target_tcp_proxy_provider_spec.rb | 5 + ...ompute_target_vpn_gateway_provider_spec.rb | 5 + spec/gcompute_url_map_provider_spec.rb | 5 + spec/gcompute_vpn_tunnel_provider_spec.rb | 5 + spec/gcompute_zone_provider_spec.rb | 5 + spec/integration/address/integration_spec.rb | 59 ++++++++++ .../backend_bucket/integration_spec.rb | 59 ++++++++++ .../backend_service/integration_spec.rb | 59 ++++++++++ spec/integration/disk/integration_spec.rb | 59 ++++++++++ spec/integration/firewall/integration_spec.rb | 59 ++++++++++ .../forwarding_rule/integration_spec.rb | 59 ++++++++++ .../global_address/integration_spec.rb | 59 ++++++++++ .../integration_spec.rb | 59 ++++++++++ .../health_check/integration_spec.rb | 59 ++++++++++ .../http_health_check/integration_spec.rb | 59 ++++++++++ .../https_health_check/integration_spec.rb | 59 ++++++++++ spec/integration/image/integration_spec.rb | 59 ++++++++++ spec/integration/instance/integration_spec.rb | 59 ++++++++++ .../instance_group/integration_spec.rb | 59 ++++++++++ .../integration_spec.rb | 59 ++++++++++ .../instance_template/integration_spec.rb | 59 ++++++++++ spec/integration/route/integration_spec.rb | 59 ++++++++++ spec/integration/snapshot/integration_spec.rb | 59 ++++++++++ .../ssl_certificate/integration_spec.rb | 59 ++++++++++ .../subnetwork/integration_spec.rb | 59 ++++++++++ .../target_http_proxy/integration_spec.rb | 59 ++++++++++ .../target_https_proxy/integration_spec.rb | 59 ++++++++++ .../target_pool/integration_spec.rb | 59 ++++++++++ .../target_ssl_proxy/integration_spec.rb | 59 ++++++++++ .../target_tcp_proxy/integration_spec.rb | 59 ++++++++++ spec/integration/url_map/integration_spec.rb | 59 ++++++++++ spec/spec_helper.rb | 105 +++++++++++++----- 68 files changed, 1940 insertions(+), 28 deletions(-) create mode 100644 .fixtures.yml create mode 100644 Rakefile create mode 100644 spec/fixtures/mock_hc_fn.pp create mode 100644 spec/integration/address/integration_spec.rb create mode 100644 spec/integration/backend_bucket/integration_spec.rb create mode 100644 spec/integration/backend_service/integration_spec.rb create mode 100644 spec/integration/disk/integration_spec.rb create mode 100644 spec/integration/firewall/integration_spec.rb create mode 100644 spec/integration/forwarding_rule/integration_spec.rb create mode 100644 spec/integration/global_address/integration_spec.rb create mode 100644 spec/integration/global_forwarding_rule/integration_spec.rb create mode 100644 spec/integration/health_check/integration_spec.rb create mode 100644 spec/integration/http_health_check/integration_spec.rb create mode 100644 spec/integration/https_health_check/integration_spec.rb create mode 100644 spec/integration/image/integration_spec.rb create mode 100644 spec/integration/instance/integration_spec.rb create mode 100644 spec/integration/instance_group/integration_spec.rb create mode 100644 spec/integration/instance_group_manager/integration_spec.rb create mode 100644 spec/integration/instance_template/integration_spec.rb create mode 100644 spec/integration/route/integration_spec.rb create mode 100644 spec/integration/snapshot/integration_spec.rb create mode 100644 spec/integration/ssl_certificate/integration_spec.rb create mode 100644 spec/integration/subnetwork/integration_spec.rb create mode 100644 spec/integration/target_http_proxy/integration_spec.rb create mode 100644 spec/integration/target_https_proxy/integration_spec.rb create mode 100644 spec/integration/target_pool/integration_spec.rb create mode 100644 spec/integration/target_ssl_proxy/integration_spec.rb create mode 100644 spec/integration/target_tcp_proxy/integration_spec.rb create mode 100644 spec/integration/url_map/integration_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..00d18618 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,33 @@ +--- +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- + +fixtures: + forge_modules: + gauth: google/gauth + symlinks: + gcompute: "#{source_dir}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a915cec8..43e93758 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,6 +83,7 @@ If you find an issue with them there are 2 options: The list below contains all the files that were automatically generated by puppet-codegen: + * .fixtures.yml * .gitignore * .rubocop.yml * .tools/end2end/data/address.pp @@ -612,6 +613,7 @@ puppet-codegen: * spec/data/network/gcompute_zone/success3~name.yaml * spec/data/network/gcompute_zone/success3~title.yaml * spec/fake_auth.rb + * spec/fixtures/mock_hc_fn.pp * spec/gcompute_address_provider_spec.rb * spec/gcompute_backend_bucket_provider_spec.rb * spec/gcompute_backend_service_provider_spec.rb @@ -647,6 +649,32 @@ puppet-codegen: * spec/gcompute_url_map_provider_spec.rb * spec/gcompute_vpn_tunnel_provider_spec.rb * spec/gcompute_zone_provider_spec.rb + * spec/integration/address/integration_spec.rb + * spec/integration/backend_bucket/integration_spec.rb + * spec/integration/backend_service/integration_spec.rb + * spec/integration/disk/integration_spec.rb + * spec/integration/firewall/integration_spec.rb + * spec/integration/forwarding_rule/integration_spec.rb + * spec/integration/global_address/integration_spec.rb + * spec/integration/global_forwarding_rule/integration_spec.rb + * spec/integration/health_check/integration_spec.rb + * spec/integration/http_health_check/integration_spec.rb + * spec/integration/https_health_check/integration_spec.rb + * spec/integration/image/integration_spec.rb + * spec/integration/instance/integration_spec.rb + * spec/integration/instance_group/integration_spec.rb + * spec/integration/instance_group_manager/integration_spec.rb + * spec/integration/instance_template/integration_spec.rb + * spec/integration/route/integration_spec.rb + * spec/integration/snapshot/integration_spec.rb + * spec/integration/ssl_certificate/integration_spec.rb + * spec/integration/subnetwork/integration_spec.rb + * spec/integration/target_http_proxy/integration_spec.rb + * spec/integration/target_https_proxy/integration_spec.rb + * spec/integration/target_pool/integration_spec.rb + * spec/integration/target_ssl_proxy/integration_spec.rb + * spec/integration/target_tcp_proxy/integration_spec.rb + * spec/integration/url_map/integration_spec.rb * spec/network_blocker.rb * spec/network_blocker_spec.rb * spec/network_delete_spec.rb @@ -674,6 +702,7 @@ central location: * lib/google/object_store.rb * lib/google/string_utils.rb * LICENSE + * Rakefile * spec/copyright.rb * spec/copyright_spec.rb * spec/data/copyright_bad1.rb diff --git a/Gemfile b/Gemfile index f8e609d6..80c53d80 100644 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,10 @@ source 'https://rubygems.org' group :test do + gem 'google-api-client' + gem 'googleauth' gem 'metadata-json-lint' + gem 'parallel_tests' gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '>= 4.2.0' gem 'puppet-lint' gem 'puppet-lint-unquoted_string-check' @@ -37,7 +40,9 @@ group :test do gem 'rspec' gem 'rspec-mocks' gem 'rspec-puppet' - gem 'parallel_tests' gem 'rubocop' + gem 'semantic_puppet' gem 'simplecov' + gem 'vcr' + gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index eb424232..f64cad47 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,9 +4,15 @@ GEM addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) ast (2.4.0) + crack (0.4.3) + safe_yaml (~> 1.0.0) + declarative (0.0.10) + declarative-option (0.1.0) diff-lcs (1.3) docile (1.1.5) facter (2.5.1) + faraday (0.15.2) + multipart-post (>= 1.2, < 3) fast_gettext (1.1.2) gettext (3.2.6) locale (>= 2.0.5) @@ -15,17 +21,42 @@ GEM fast_gettext (~> 1.1.0) gettext (>= 3.0.2) locale + google-api-client (0.23.8) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.5, < 0.7.0) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.9) + googleauth (0.6.6) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.7) + hashdiff (0.3.7) hiera (3.4.2) + httpclient (2.8.3) json (2.1.0) json-schema (2.8.0) addressable (>= 2.4) + jwt (2.1.0) locale (2.1.2) + memoist (0.16.0) metaclass (0.0.4) metadata-json-lint (2.0.2) json-schema (~> 2.8) spdx-licenses (~> 1.0) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2018.0812) mocha (1.3.0) metaclass (~> 0.0.1) + multi_json (1.13.1) + multipart-post (2.0.0) + os (1.0.0) parallel (1.12.1) parallel_tests (2.21.3) parallel @@ -50,6 +81,11 @@ GEM rspec-puppet (~> 2.0) rainbow (3.0.0) rake (10.5.0) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) rspec (3.7.0) rspec-core (~> 3.7.0) rspec-expectations (~> 3.7.0) @@ -73,6 +109,13 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) + safe_yaml (1.0.4) + semantic_puppet (1.0.2) + signet (0.9.1) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) simplecov (0.15.1) docile (~> 1.1.0) json (>= 1.8, < 3) @@ -80,12 +123,20 @@ GEM simplecov-html (0.10.2) spdx-licenses (1.1.0) text (1.3.1) + uber (0.1.0) unicode-display_width (1.3.0) + vcr (4.0.0) + webmock (3.4.2) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff PLATFORMS ruby DEPENDENCIES + google-api-client + googleauth metadata-json-lint parallel_tests puppet (>= 4.2.0) @@ -98,7 +149,10 @@ DEPENDENCIES rspec-mocks rspec-puppet rubocop + semantic_puppet simplecov + vcr + webmock BUNDLED WITH 1.16.1 diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..cd3d3799 --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/rake_tasks' diff --git a/spec/fixtures/mock_hc_fn.pp b/spec/fixtures/mock_hc_fn.pp new file mode 100644 index 00000000..a2661368 --- /dev/null +++ b/spec/fixtures/mock_hc_fn.pp @@ -0,0 +1,30 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- + +function gcompute_health_check_ref(String $name, String $project_name) >> String { + "https://www.googleapis.com/compute/v1/projects/$project_name/global/healthChecks/$name" +} diff --git a/spec/gcompute_address_provider_spec.rb b/spec/gcompute_address_provider_spec.rb index 2ae3dfd5..e61cdf76 100644 --- a/spec/gcompute_address_provider_spec.rb +++ b/spec/gcompute_address_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_address).provider(:google) do before(:all) do diff --git a/spec/gcompute_backend_bucket_provider_spec.rb b/spec/gcompute_backend_bucket_provider_spec.rb index 584d1f37..1b7bba6c 100644 --- a/spec/gcompute_backend_bucket_provider_spec.rb +++ b/spec/gcompute_backend_bucket_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_backend_bucket).provider(:google) do before(:all) do diff --git a/spec/gcompute_backend_service_provider_spec.rb b/spec/gcompute_backend_service_provider_spec.rb index bccad7cd..439ae7fe 100644 --- a/spec/gcompute_backend_service_provider_spec.rb +++ b/spec/gcompute_backend_service_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_backend_service).provider(:google) do before(:all) do diff --git a/spec/gcompute_disk_provider_spec.rb b/spec/gcompute_disk_provider_spec.rb index 9d5b65d9..47149290 100644 --- a/spec/gcompute_disk_provider_spec.rb +++ b/spec/gcompute_disk_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_disk).provider(:google) do before(:all) do diff --git a/spec/gcompute_disk_type_provider_spec.rb b/spec/gcompute_disk_type_provider_spec.rb index 41c45ecb..fb0e0564 100644 --- a/spec/gcompute_disk_type_provider_spec.rb +++ b/spec/gcompute_disk_type_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_disk_type).provider(:google) do before(:all) do diff --git a/spec/gcompute_firewall_provider_spec.rb b/spec/gcompute_firewall_provider_spec.rb index e4c94a4b..06bd3675 100644 --- a/spec/gcompute_firewall_provider_spec.rb +++ b/spec/gcompute_firewall_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_firewall).provider(:google) do before(:all) do diff --git a/spec/gcompute_forwarding_rule_provider_spec.rb b/spec/gcompute_forwarding_rule_provider_spec.rb index 19de0013..a043fd64 100644 --- a/spec/gcompute_forwarding_rule_provider_spec.rb +++ b/spec/gcompute_forwarding_rule_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_forwarding_rule).provider(:google) do before(:all) do diff --git a/spec/gcompute_global_address_provider_spec.rb b/spec/gcompute_global_address_provider_spec.rb index bb25d227..0cf0004c 100644 --- a/spec/gcompute_global_address_provider_spec.rb +++ b/spec/gcompute_global_address_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_global_address).provider(:google) do before(:all) do diff --git a/spec/gcompute_global_forwarding_rule_provider_spec.rb b/spec/gcompute_global_forwarding_rule_provider_spec.rb index ae83645f..5dfc97b6 100644 --- a/spec/gcompute_global_forwarding_rule_provider_spec.rb +++ b/spec/gcompute_global_forwarding_rule_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_global_forwarding_rule).provider(:google) do before(:all) do diff --git a/spec/gcompute_health_check_provider_spec.rb b/spec/gcompute_health_check_provider_spec.rb index 1844afb3..159c1e49 100644 --- a/spec/gcompute_health_check_provider_spec.rb +++ b/spec/gcompute_health_check_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_health_check).provider(:google) do before(:all) do diff --git a/spec/gcompute_http_health_check_provider_spec.rb b/spec/gcompute_http_health_check_provider_spec.rb index 7c9dcb7f..bd4e3d7f 100644 --- a/spec/gcompute_http_health_check_provider_spec.rb +++ b/spec/gcompute_http_health_check_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_http_health_check).provider(:google) do before(:all) do diff --git a/spec/gcompute_https_health_check_provider_spec.rb b/spec/gcompute_https_health_check_provider_spec.rb index c239a498..ff5867c1 100644 --- a/spec/gcompute_https_health_check_provider_spec.rb +++ b/spec/gcompute_https_health_check_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_https_health_check).provider(:google) do before(:all) do diff --git a/spec/gcompute_image_provider_spec.rb b/spec/gcompute_image_provider_spec.rb index 075b3459..94c9cb78 100644 --- a/spec/gcompute_image_provider_spec.rb +++ b/spec/gcompute_image_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_image).provider(:google) do before(:all) do diff --git a/spec/gcompute_instance_group_manager_provider_spec.rb b/spec/gcompute_instance_group_manager_provider_spec.rb index 28860f7a..d7ee1d62 100644 --- a/spec/gcompute_instance_group_manager_provider_spec.rb +++ b/spec/gcompute_instance_group_manager_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_instance_group_manager).provider(:google) do before(:all) do diff --git a/spec/gcompute_instance_group_provider_spec.rb b/spec/gcompute_instance_group_provider_spec.rb index e6f8c30b..b2097765 100644 --- a/spec/gcompute_instance_group_provider_spec.rb +++ b/spec/gcompute_instance_group_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_instance_group).provider(:google) do before(:all) do diff --git a/spec/gcompute_instance_provider_spec.rb b/spec/gcompute_instance_provider_spec.rb index 6c361dba..5699b4ce 100644 --- a/spec/gcompute_instance_provider_spec.rb +++ b/spec/gcompute_instance_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_instance).provider(:google) do before(:all) do diff --git a/spec/gcompute_instance_template_provider_spec.rb b/spec/gcompute_instance_template_provider_spec.rb index ec39cfc4..6124aa2d 100644 --- a/spec/gcompute_instance_template_provider_spec.rb +++ b/spec/gcompute_instance_template_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_instance_template).provider(:google) do before(:all) do diff --git a/spec/gcompute_license_provider_spec.rb b/spec/gcompute_license_provider_spec.rb index 0e6c2097..a3f2abff 100644 --- a/spec/gcompute_license_provider_spec.rb +++ b/spec/gcompute_license_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_license).provider(:google) do before(:all) do diff --git a/spec/gcompute_machine_type_provider_spec.rb b/spec/gcompute_machine_type_provider_spec.rb index 62e97d51..2aecf896 100644 --- a/spec/gcompute_machine_type_provider_spec.rb +++ b/spec/gcompute_machine_type_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_machine_type).provider(:google) do before(:all) do diff --git a/spec/gcompute_network_provider_spec.rb b/spec/gcompute_network_provider_spec.rb index 055d14d8..a7172444 100644 --- a/spec/gcompute_network_provider_spec.rb +++ b/spec/gcompute_network_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_network).provider(:google) do before(:all) do diff --git a/spec/gcompute_region_provider_spec.rb b/spec/gcompute_region_provider_spec.rb index f7678f2e..54c732c9 100644 --- a/spec/gcompute_region_provider_spec.rb +++ b/spec/gcompute_region_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_region).provider(:google) do before(:all) do diff --git a/spec/gcompute_route_provider_spec.rb b/spec/gcompute_route_provider_spec.rb index 9cfb1996..1e1c7f28 100644 --- a/spec/gcompute_route_provider_spec.rb +++ b/spec/gcompute_route_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_route).provider(:google) do before(:all) do diff --git a/spec/gcompute_router_provider_spec.rb b/spec/gcompute_router_provider_spec.rb index 9aa565d1..ba3a4d7e 100644 --- a/spec/gcompute_router_provider_spec.rb +++ b/spec/gcompute_router_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_router).provider(:google) do before(:all) do diff --git a/spec/gcompute_snapshot_provider_spec.rb b/spec/gcompute_snapshot_provider_spec.rb index 2d17d65b..6f9ca662 100644 --- a/spec/gcompute_snapshot_provider_spec.rb +++ b/spec/gcompute_snapshot_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_snapshot).provider(:google) do before(:all) do diff --git a/spec/gcompute_ssl_certificate_provider_spec.rb b/spec/gcompute_ssl_certificate_provider_spec.rb index 88642ddd..ea00a7f0 100644 --- a/spec/gcompute_ssl_certificate_provider_spec.rb +++ b/spec/gcompute_ssl_certificate_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_ssl_certificate).provider(:google) do before(:all) do diff --git a/spec/gcompute_subnetwork_provider_spec.rb b/spec/gcompute_subnetwork_provider_spec.rb index ac3623ba..95b1b99f 100644 --- a/spec/gcompute_subnetwork_provider_spec.rb +++ b/spec/gcompute_subnetwork_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_subnetwork).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_http_proxy_provider_spec.rb b/spec/gcompute_target_http_proxy_provider_spec.rb index 5bee45d1..eff6bbce 100644 --- a/spec/gcompute_target_http_proxy_provider_spec.rb +++ b/spec/gcompute_target_http_proxy_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_http_proxy).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_https_proxy_provider_spec.rb b/spec/gcompute_target_https_proxy_provider_spec.rb index 10ecb869..429d985f 100644 --- a/spec/gcompute_target_https_proxy_provider_spec.rb +++ b/spec/gcompute_target_https_proxy_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_https_proxy).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_pool_provider_spec.rb b/spec/gcompute_target_pool_provider_spec.rb index af11668d..a18d88cf 100644 --- a/spec/gcompute_target_pool_provider_spec.rb +++ b/spec/gcompute_target_pool_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_pool).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_ssl_proxy_provider_spec.rb b/spec/gcompute_target_ssl_proxy_provider_spec.rb index 2835363a..beb95cde 100644 --- a/spec/gcompute_target_ssl_proxy_provider_spec.rb +++ b/spec/gcompute_target_ssl_proxy_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_ssl_proxy).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_tcp_proxy_provider_spec.rb b/spec/gcompute_target_tcp_proxy_provider_spec.rb index 7fec1656..923e8df3 100644 --- a/spec/gcompute_target_tcp_proxy_provider_spec.rb +++ b/spec/gcompute_target_tcp_proxy_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_tcp_proxy).provider(:google) do before(:all) do diff --git a/spec/gcompute_target_vpn_gateway_provider_spec.rb b/spec/gcompute_target_vpn_gateway_provider_spec.rb index 642c2197..21a40ca6 100644 --- a/spec/gcompute_target_vpn_gateway_provider_spec.rb +++ b/spec/gcompute_target_vpn_gateway_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_target_vpn_gateway).provider(:google) do before(:all) do diff --git a/spec/gcompute_url_map_provider_spec.rb b/spec/gcompute_url_map_provider_spec.rb index 75ad8f47..77be9cfa 100644 --- a/spec/gcompute_url_map_provider_spec.rb +++ b/spec/gcompute_url_map_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_url_map).provider(:google) do before(:all) do diff --git a/spec/gcompute_vpn_tunnel_provider_spec.rb b/spec/gcompute_vpn_tunnel_provider_spec.rb index ee8bf971..c5891143 100644 --- a/spec/gcompute_vpn_tunnel_provider_spec.rb +++ b/spec/gcompute_vpn_tunnel_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_vpn_tunnel).provider(:google) do before(:all) do diff --git a/spec/gcompute_zone_provider_spec.rb b/spec/gcompute_zone_provider_spec.rb index 9e2b81bf..f0b4a3db 100644 --- a/spec/gcompute_zone_provider_spec.rb +++ b/spec/gcompute_zone_provider_spec.rb @@ -26,6 +26,11 @@ # ---------------------------------------------------------------------------- require 'spec_helper' +require 'network_blocker' +require 'spec/bundle.rb' +require 'spec/copyright.rb' +require 'spec/fake_auth.rb' +require 'spec/test_constants.rb' describe Puppet::Type.type(:gcompute_zone).provider(:google) do before(:all) do diff --git a/spec/integration/address/integration_spec.rb b/spec/integration/address/integration_spec.rb new file mode 100644 index 00000000..6b1d6261 --- /dev/null +++ b/spec/integration/address/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'address.create', vcr: true do + it 'creates and destroys non-existent address' do + puts 'pre-destroying address' + VCR.use_cassette('pre_destroy_address') do + run_example('delete_address') + end + puts 'creating address' + VCR.use_cassette('create_address') do + run_example('address') + end + puts 'checking that address is created' + VCR.use_cassette('check_address') do + validate_no_flush_calls('address') + end + puts 'destroying address' + VCR.use_cassette('destroy_address') do + run_example('delete_address') + end + puts 'confirming address destroyed' + VCR.use_cassette('check_destroy_address') do + validate_no_flush_calls('delete_address') + end + end +end diff --git a/spec/integration/backend_bucket/integration_spec.rb b/spec/integration/backend_bucket/integration_spec.rb new file mode 100644 index 00000000..3e61d26f --- /dev/null +++ b/spec/integration/backend_bucket/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'backend_bucket.create', vcr: true do + it 'creates and destroys non-existent backend_bucket' do + puts 'pre-destroying backend_bucket' + VCR.use_cassette('pre_destroy_backend_bucket') do + run_example('delete_backend_bucket') + end + puts 'creating backend_bucket' + VCR.use_cassette('create_backend_bucket') do + run_example('backend_bucket') + end + puts 'checking that backend_bucket is created' + VCR.use_cassette('check_backend_bucket') do + validate_no_flush_calls('backend_bucket') + end + puts 'destroying backend_bucket' + VCR.use_cassette('destroy_backend_bucket') do + run_example('delete_backend_bucket') + end + puts 'confirming backend_bucket destroyed' + VCR.use_cassette('check_destroy_backend_bucket') do + validate_no_flush_calls('delete_backend_bucket') + end + end +end diff --git a/spec/integration/backend_service/integration_spec.rb b/spec/integration/backend_service/integration_spec.rb new file mode 100644 index 00000000..1d45be72 --- /dev/null +++ b/spec/integration/backend_service/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'backend_service.create', vcr: true do + it 'creates and destroys non-existent backend_service' do + puts 'pre-destroying backend_service' + VCR.use_cassette('pre_destroy_backend_service') do + run_example('delete_backend_service') + end + puts 'creating backend_service' + VCR.use_cassette('create_backend_service') do + run_example('backend_service') + end + puts 'checking that backend_service is created' + VCR.use_cassette('check_backend_service') do + validate_no_flush_calls('backend_service') + end + puts 'destroying backend_service' + VCR.use_cassette('destroy_backend_service') do + run_example('delete_backend_service') + end + puts 'confirming backend_service destroyed' + VCR.use_cassette('check_destroy_backend_service') do + validate_no_flush_calls('delete_backend_service') + end + end +end diff --git a/spec/integration/disk/integration_spec.rb b/spec/integration/disk/integration_spec.rb new file mode 100644 index 00000000..f7519f4c --- /dev/null +++ b/spec/integration/disk/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'disk.create', vcr: true do + it 'creates and destroys non-existent disk' do + puts 'pre-destroying disk' + VCR.use_cassette('pre_destroy_disk') do + run_example('delete_disk') + end + puts 'creating disk' + VCR.use_cassette('create_disk') do + run_example('disk') + end + puts 'checking that disk is created' + VCR.use_cassette('check_disk') do + validate_no_flush_calls('disk') + end + puts 'destroying disk' + VCR.use_cassette('destroy_disk') do + run_example('delete_disk') + end + puts 'confirming disk destroyed' + VCR.use_cassette('check_destroy_disk') do + validate_no_flush_calls('delete_disk') + end + end +end diff --git a/spec/integration/firewall/integration_spec.rb b/spec/integration/firewall/integration_spec.rb new file mode 100644 index 00000000..7ffbac0e --- /dev/null +++ b/spec/integration/firewall/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'firewall.create', vcr: true do + it 'creates and destroys non-existent firewall' do + puts 'pre-destroying firewall' + VCR.use_cassette('pre_destroy_firewall') do + run_example('delete_firewall') + end + puts 'creating firewall' + VCR.use_cassette('create_firewall') do + run_example('firewall') + end + puts 'checking that firewall is created' + VCR.use_cassette('check_firewall') do + validate_no_flush_calls('firewall') + end + puts 'destroying firewall' + VCR.use_cassette('destroy_firewall') do + run_example('delete_firewall') + end + puts 'confirming firewall destroyed' + VCR.use_cassette('check_destroy_firewall') do + validate_no_flush_calls('delete_firewall') + end + end +end diff --git a/spec/integration/forwarding_rule/integration_spec.rb b/spec/integration/forwarding_rule/integration_spec.rb new file mode 100644 index 00000000..fd7bc82e --- /dev/null +++ b/spec/integration/forwarding_rule/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'forwarding_rule.create', vcr: true do + it 'creates and destroys non-existent forwarding_rule' do + puts 'pre-destroying forwarding_rule' + VCR.use_cassette('pre_destroy_forwarding_rule') do + run_example('delete_forwarding_rule') + end + puts 'creating forwarding_rule' + VCR.use_cassette('create_forwarding_rule') do + run_example('forwarding_rule') + end + puts 'checking that forwarding_rule is created' + VCR.use_cassette('check_forwarding_rule') do + validate_no_flush_calls('forwarding_rule') + end + puts 'destroying forwarding_rule' + VCR.use_cassette('destroy_forwarding_rule') do + run_example('delete_forwarding_rule') + end + puts 'confirming forwarding_rule destroyed' + VCR.use_cassette('check_destroy_forwarding_rule') do + validate_no_flush_calls('delete_forwarding_rule') + end + end +end diff --git a/spec/integration/global_address/integration_spec.rb b/spec/integration/global_address/integration_spec.rb new file mode 100644 index 00000000..a7b1f052 --- /dev/null +++ b/spec/integration/global_address/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'global_address.create', vcr: true do + it 'creates and destroys non-existent global_address' do + puts 'pre-destroying global_address' + VCR.use_cassette('pre_destroy_global_address') do + run_example('delete_global_address') + end + puts 'creating global_address' + VCR.use_cassette('create_global_address') do + run_example('global_address') + end + puts 'checking that global_address is created' + VCR.use_cassette('check_global_address') do + validate_no_flush_calls('global_address') + end + puts 'destroying global_address' + VCR.use_cassette('destroy_global_address') do + run_example('delete_global_address') + end + puts 'confirming global_address destroyed' + VCR.use_cassette('check_destroy_global_address') do + validate_no_flush_calls('delete_global_address') + end + end +end diff --git a/spec/integration/global_forwarding_rule/integration_spec.rb b/spec/integration/global_forwarding_rule/integration_spec.rb new file mode 100644 index 00000000..df10b087 --- /dev/null +++ b/spec/integration/global_forwarding_rule/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'global_forwarding_rule.create', vcr: true do + it 'creates and destroys non-existent global_forwarding_rule' do + puts 'pre-destroying global_forwarding_rule' + VCR.use_cassette('pre_destroy_global_forwarding_rule') do + run_example('delete_global_forwarding_rule') + end + puts 'creating global_forwarding_rule' + VCR.use_cassette('create_global_forwarding_rule') do + run_example('global_forwarding_rule') + end + puts 'checking that global_forwarding_rule is created' + VCR.use_cassette('check_global_forwarding_rule') do + validate_no_flush_calls('global_forwarding_rule') + end + puts 'destroying global_forwarding_rule' + VCR.use_cassette('destroy_global_forwarding_rule') do + run_example('delete_global_forwarding_rule') + end + puts 'confirming global_forwarding_rule destroyed' + VCR.use_cassette('check_destroy_global_forwarding_rule') do + validate_no_flush_calls('delete_global_forwarding_rule') + end + end +end diff --git a/spec/integration/health_check/integration_spec.rb b/spec/integration/health_check/integration_spec.rb new file mode 100644 index 00000000..18a6a16e --- /dev/null +++ b/spec/integration/health_check/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'health_check.create', vcr: true do + it 'creates and destroys non-existent health_check' do + puts 'pre-destroying health_check' + VCR.use_cassette('pre_destroy_health_check') do + run_example('delete_health_check') + end + puts 'creating health_check' + VCR.use_cassette('create_health_check') do + run_example('health_check') + end + puts 'checking that health_check is created' + VCR.use_cassette('check_health_check') do + validate_no_flush_calls('health_check') + end + puts 'destroying health_check' + VCR.use_cassette('destroy_health_check') do + run_example('delete_health_check') + end + puts 'confirming health_check destroyed' + VCR.use_cassette('check_destroy_health_check') do + validate_no_flush_calls('delete_health_check') + end + end +end diff --git a/spec/integration/http_health_check/integration_spec.rb b/spec/integration/http_health_check/integration_spec.rb new file mode 100644 index 00000000..8d00eaa2 --- /dev/null +++ b/spec/integration/http_health_check/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'http_health_check.create', vcr: true do + it 'creates and destroys non-existent http_health_check' do + puts 'pre-destroying http_health_check' + VCR.use_cassette('pre_destroy_http_health_check') do + run_example('delete_http_health_check') + end + puts 'creating http_health_check' + VCR.use_cassette('create_http_health_check') do + run_example('http_health_check') + end + puts 'checking that http_health_check is created' + VCR.use_cassette('check_http_health_check') do + validate_no_flush_calls('http_health_check') + end + puts 'destroying http_health_check' + VCR.use_cassette('destroy_http_health_check') do + run_example('delete_http_health_check') + end + puts 'confirming http_health_check destroyed' + VCR.use_cassette('check_destroy_http_health_check') do + validate_no_flush_calls('delete_http_health_check') + end + end +end diff --git a/spec/integration/https_health_check/integration_spec.rb b/spec/integration/https_health_check/integration_spec.rb new file mode 100644 index 00000000..5a0003ff --- /dev/null +++ b/spec/integration/https_health_check/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'https_health_check.create', vcr: true do + it 'creates and destroys non-existent https_health_check' do + puts 'pre-destroying https_health_check' + VCR.use_cassette('pre_destroy_https_health_check') do + run_example('delete_https_health_check') + end + puts 'creating https_health_check' + VCR.use_cassette('create_https_health_check') do + run_example('https_health_check') + end + puts 'checking that https_health_check is created' + VCR.use_cassette('check_https_health_check') do + validate_no_flush_calls('https_health_check') + end + puts 'destroying https_health_check' + VCR.use_cassette('destroy_https_health_check') do + run_example('delete_https_health_check') + end + puts 'confirming https_health_check destroyed' + VCR.use_cassette('check_destroy_https_health_check') do + validate_no_flush_calls('delete_https_health_check') + end + end +end diff --git a/spec/integration/image/integration_spec.rb b/spec/integration/image/integration_spec.rb new file mode 100644 index 00000000..2362c27f --- /dev/null +++ b/spec/integration/image/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'image.create', vcr: true do + it 'creates and destroys non-existent image' do + puts 'pre-destroying image' + VCR.use_cassette('pre_destroy_image') do + run_example('delete_image') + end + puts 'creating image' + VCR.use_cassette('create_image') do + run_example('image') + end + puts 'checking that image is created' + VCR.use_cassette('check_image') do + validate_no_flush_calls('image') + end + puts 'destroying image' + VCR.use_cassette('destroy_image') do + run_example('delete_image') + end + puts 'confirming image destroyed' + VCR.use_cassette('check_destroy_image') do + validate_no_flush_calls('delete_image') + end + end +end diff --git a/spec/integration/instance/integration_spec.rb b/spec/integration/instance/integration_spec.rb new file mode 100644 index 00000000..5f1d84fa --- /dev/null +++ b/spec/integration/instance/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'instance.create', vcr: true do + it 'creates and destroys non-existent instance' do + puts 'pre-destroying instance' + VCR.use_cassette('pre_destroy_instance') do + run_example('delete_instance') + end + puts 'creating instance' + VCR.use_cassette('create_instance') do + run_example('instance') + end + puts 'checking that instance is created' + VCR.use_cassette('check_instance') do + validate_no_flush_calls('instance') + end + puts 'destroying instance' + VCR.use_cassette('destroy_instance') do + run_example('delete_instance') + end + puts 'confirming instance destroyed' + VCR.use_cassette('check_destroy_instance') do + validate_no_flush_calls('delete_instance') + end + end +end diff --git a/spec/integration/instance_group/integration_spec.rb b/spec/integration/instance_group/integration_spec.rb new file mode 100644 index 00000000..b79e9520 --- /dev/null +++ b/spec/integration/instance_group/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'instance_group.create', vcr: true do + it 'creates and destroys non-existent instance_group' do + puts 'pre-destroying instance_group' + VCR.use_cassette('pre_destroy_instance_group') do + run_example('delete_instance_group') + end + puts 'creating instance_group' + VCR.use_cassette('create_instance_group') do + run_example('instance_group') + end + puts 'checking that instance_group is created' + VCR.use_cassette('check_instance_group') do + validate_no_flush_calls('instance_group') + end + puts 'destroying instance_group' + VCR.use_cassette('destroy_instance_group') do + run_example('delete_instance_group') + end + puts 'confirming instance_group destroyed' + VCR.use_cassette('check_destroy_instance_group') do + validate_no_flush_calls('delete_instance_group') + end + end +end diff --git a/spec/integration/instance_group_manager/integration_spec.rb b/spec/integration/instance_group_manager/integration_spec.rb new file mode 100644 index 00000000..e080b4a6 --- /dev/null +++ b/spec/integration/instance_group_manager/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'instance_group_manager.create', vcr: true do + it 'creates and destroys non-existent instance_group_manager' do + puts 'pre-destroying instance_group_manager' + VCR.use_cassette('pre_destroy_instance_group_manager') do + run_example('delete_instance_group_manager') + end + puts 'creating instance_group_manager' + VCR.use_cassette('create_instance_group_manager') do + run_example('instance_group_manager') + end + puts 'checking that instance_group_manager is created' + VCR.use_cassette('check_instance_group_manager') do + validate_no_flush_calls('instance_group_manager') + end + puts 'destroying instance_group_manager' + VCR.use_cassette('destroy_instance_group_manager') do + run_example('delete_instance_group_manager') + end + puts 'confirming instance_group_manager destroyed' + VCR.use_cassette('check_destroy_instance_group_manager') do + validate_no_flush_calls('delete_instance_group_manager') + end + end +end diff --git a/spec/integration/instance_template/integration_spec.rb b/spec/integration/instance_template/integration_spec.rb new file mode 100644 index 00000000..44457784 --- /dev/null +++ b/spec/integration/instance_template/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'instance_template.create', vcr: true do + it 'creates and destroys non-existent instance_template' do + puts 'pre-destroying instance_template' + VCR.use_cassette('pre_destroy_instance_template') do + run_example('delete_instance_template') + end + puts 'creating instance_template' + VCR.use_cassette('create_instance_template') do + run_example('instance_template') + end + puts 'checking that instance_template is created' + VCR.use_cassette('check_instance_template') do + validate_no_flush_calls('instance_template') + end + puts 'destroying instance_template' + VCR.use_cassette('destroy_instance_template') do + run_example('delete_instance_template') + end + puts 'confirming instance_template destroyed' + VCR.use_cassette('check_destroy_instance_template') do + validate_no_flush_calls('delete_instance_template') + end + end +end diff --git a/spec/integration/route/integration_spec.rb b/spec/integration/route/integration_spec.rb new file mode 100644 index 00000000..05cdd714 --- /dev/null +++ b/spec/integration/route/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'route.create', vcr: true do + it 'creates and destroys non-existent route' do + puts 'pre-destroying route' + VCR.use_cassette('pre_destroy_route') do + run_example('delete_route') + end + puts 'creating route' + VCR.use_cassette('create_route') do + run_example('route') + end + puts 'checking that route is created' + VCR.use_cassette('check_route') do + validate_no_flush_calls('route') + end + puts 'destroying route' + VCR.use_cassette('destroy_route') do + run_example('delete_route') + end + puts 'confirming route destroyed' + VCR.use_cassette('check_destroy_route') do + validate_no_flush_calls('delete_route') + end + end +end diff --git a/spec/integration/snapshot/integration_spec.rb b/spec/integration/snapshot/integration_spec.rb new file mode 100644 index 00000000..262c947b --- /dev/null +++ b/spec/integration/snapshot/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'snapshot.create', vcr: true do + it 'creates and destroys non-existent snapshot' do + puts 'pre-destroying snapshot' + VCR.use_cassette('pre_destroy_snapshot') do + run_example('delete_snapshot') + end + puts 'creating snapshot' + VCR.use_cassette('create_snapshot') do + run_example('snapshot') + end + puts 'checking that snapshot is created' + VCR.use_cassette('check_snapshot') do + validate_no_flush_calls('snapshot') + end + puts 'destroying snapshot' + VCR.use_cassette('destroy_snapshot') do + run_example('delete_snapshot') + end + puts 'confirming snapshot destroyed' + VCR.use_cassette('check_destroy_snapshot') do + validate_no_flush_calls('delete_snapshot') + end + end +end diff --git a/spec/integration/ssl_certificate/integration_spec.rb b/spec/integration/ssl_certificate/integration_spec.rb new file mode 100644 index 00000000..845203ab --- /dev/null +++ b/spec/integration/ssl_certificate/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'ssl_certificate.create', vcr: true do + it 'creates and destroys non-existent ssl_certificate' do + puts 'pre-destroying ssl_certificate' + VCR.use_cassette('pre_destroy_ssl_certificate') do + run_example('delete_ssl_certificate') + end + puts 'creating ssl_certificate' + VCR.use_cassette('create_ssl_certificate') do + run_example('ssl_certificate') + end + puts 'checking that ssl_certificate is created' + VCR.use_cassette('check_ssl_certificate') do + validate_no_flush_calls('ssl_certificate') + end + puts 'destroying ssl_certificate' + VCR.use_cassette('destroy_ssl_certificate') do + run_example('delete_ssl_certificate') + end + puts 'confirming ssl_certificate destroyed' + VCR.use_cassette('check_destroy_ssl_certificate') do + validate_no_flush_calls('delete_ssl_certificate') + end + end +end diff --git a/spec/integration/subnetwork/integration_spec.rb b/spec/integration/subnetwork/integration_spec.rb new file mode 100644 index 00000000..2e52152e --- /dev/null +++ b/spec/integration/subnetwork/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'subnetwork.create', vcr: true do + it 'creates and destroys non-existent subnetwork' do + puts 'pre-destroying subnetwork' + VCR.use_cassette('pre_destroy_subnetwork') do + run_example('delete_subnetwork') + end + puts 'creating subnetwork' + VCR.use_cassette('create_subnetwork') do + run_example('subnetwork') + end + puts 'checking that subnetwork is created' + VCR.use_cassette('check_subnetwork') do + validate_no_flush_calls('subnetwork') + end + puts 'destroying subnetwork' + VCR.use_cassette('destroy_subnetwork') do + run_example('delete_subnetwork') + end + puts 'confirming subnetwork destroyed' + VCR.use_cassette('check_destroy_subnetwork') do + validate_no_flush_calls('delete_subnetwork') + end + end +end diff --git a/spec/integration/target_http_proxy/integration_spec.rb b/spec/integration/target_http_proxy/integration_spec.rb new file mode 100644 index 00000000..bccc96ff --- /dev/null +++ b/spec/integration/target_http_proxy/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'target_http_proxy.create', vcr: true do + it 'creates and destroys non-existent target_http_proxy' do + puts 'pre-destroying target_http_proxy' + VCR.use_cassette('pre_destroy_target_http_proxy') do + run_example('delete_target_http_proxy') + end + puts 'creating target_http_proxy' + VCR.use_cassette('create_target_http_proxy') do + run_example('target_http_proxy') + end + puts 'checking that target_http_proxy is created' + VCR.use_cassette('check_target_http_proxy') do + validate_no_flush_calls('target_http_proxy') + end + puts 'destroying target_http_proxy' + VCR.use_cassette('destroy_target_http_proxy') do + run_example('delete_target_http_proxy') + end + puts 'confirming target_http_proxy destroyed' + VCR.use_cassette('check_destroy_target_http_proxy') do + validate_no_flush_calls('delete_target_http_proxy') + end + end +end diff --git a/spec/integration/target_https_proxy/integration_spec.rb b/spec/integration/target_https_proxy/integration_spec.rb new file mode 100644 index 00000000..640fffaf --- /dev/null +++ b/spec/integration/target_https_proxy/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'target_https_proxy.create', vcr: true do + it 'creates and destroys non-existent target_https_proxy' do + puts 'pre-destroying target_https_proxy' + VCR.use_cassette('pre_destroy_target_https_proxy') do + run_example('delete_target_https_proxy') + end + puts 'creating target_https_proxy' + VCR.use_cassette('create_target_https_proxy') do + run_example('target_https_proxy') + end + puts 'checking that target_https_proxy is created' + VCR.use_cassette('check_target_https_proxy') do + validate_no_flush_calls('target_https_proxy') + end + puts 'destroying target_https_proxy' + VCR.use_cassette('destroy_target_https_proxy') do + run_example('delete_target_https_proxy') + end + puts 'confirming target_https_proxy destroyed' + VCR.use_cassette('check_destroy_target_https_proxy') do + validate_no_flush_calls('delete_target_https_proxy') + end + end +end diff --git a/spec/integration/target_pool/integration_spec.rb b/spec/integration/target_pool/integration_spec.rb new file mode 100644 index 00000000..77d632ee --- /dev/null +++ b/spec/integration/target_pool/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'target_pool.create', vcr: true do + it 'creates and destroys non-existent target_pool' do + puts 'pre-destroying target_pool' + VCR.use_cassette('pre_destroy_target_pool') do + run_example('delete_target_pool') + end + puts 'creating target_pool' + VCR.use_cassette('create_target_pool') do + run_example('target_pool') + end + puts 'checking that target_pool is created' + VCR.use_cassette('check_target_pool') do + validate_no_flush_calls('target_pool') + end + puts 'destroying target_pool' + VCR.use_cassette('destroy_target_pool') do + run_example('delete_target_pool') + end + puts 'confirming target_pool destroyed' + VCR.use_cassette('check_destroy_target_pool') do + validate_no_flush_calls('delete_target_pool') + end + end +end diff --git a/spec/integration/target_ssl_proxy/integration_spec.rb b/spec/integration/target_ssl_proxy/integration_spec.rb new file mode 100644 index 00000000..554aa2ad --- /dev/null +++ b/spec/integration/target_ssl_proxy/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'target_ssl_proxy.create', vcr: true do + it 'creates and destroys non-existent target_ssl_proxy' do + puts 'pre-destroying target_ssl_proxy' + VCR.use_cassette('pre_destroy_target_ssl_proxy') do + run_example('delete_target_ssl_proxy') + end + puts 'creating target_ssl_proxy' + VCR.use_cassette('create_target_ssl_proxy') do + run_example('target_ssl_proxy') + end + puts 'checking that target_ssl_proxy is created' + VCR.use_cassette('check_target_ssl_proxy') do + validate_no_flush_calls('target_ssl_proxy') + end + puts 'destroying target_ssl_proxy' + VCR.use_cassette('destroy_target_ssl_proxy') do + run_example('delete_target_ssl_proxy') + end + puts 'confirming target_ssl_proxy destroyed' + VCR.use_cassette('check_destroy_target_ssl_proxy') do + validate_no_flush_calls('delete_target_ssl_proxy') + end + end +end diff --git a/spec/integration/target_tcp_proxy/integration_spec.rb b/spec/integration/target_tcp_proxy/integration_spec.rb new file mode 100644 index 00000000..806809ce --- /dev/null +++ b/spec/integration/target_tcp_proxy/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'target_tcp_proxy.create', vcr: true do + it 'creates and destroys non-existent target_tcp_proxy' do + puts 'pre-destroying target_tcp_proxy' + VCR.use_cassette('pre_destroy_target_tcp_proxy') do + run_example('delete_target_tcp_proxy') + end + puts 'creating target_tcp_proxy' + VCR.use_cassette('create_target_tcp_proxy') do + run_example('target_tcp_proxy') + end + puts 'checking that target_tcp_proxy is created' + VCR.use_cassette('check_target_tcp_proxy') do + validate_no_flush_calls('target_tcp_proxy') + end + puts 'destroying target_tcp_proxy' + VCR.use_cassette('destroy_target_tcp_proxy') do + run_example('delete_target_tcp_proxy') + end + puts 'confirming target_tcp_proxy destroyed' + VCR.use_cassette('check_destroy_target_tcp_proxy') do + validate_no_flush_calls('delete_target_tcp_proxy') + end + end +end diff --git a/spec/integration/url_map/integration_spec.rb b/spec/integration/url_map/integration_spec.rb new file mode 100644 index 00000000..e7bda909 --- /dev/null +++ b/spec/integration/url_map/integration_spec.rb @@ -0,0 +1,59 @@ +# Copyright 2018 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'spec_helper' +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'spec/cassettes' + c.hook_into :webmock + c.configure_rspec_metadata! +end + +describe 'url_map.create', vcr: true do + it 'creates and destroys non-existent url_map' do + puts 'pre-destroying url_map' + VCR.use_cassette('pre_destroy_url_map') do + run_example('delete_url_map') + end + puts 'creating url_map' + VCR.use_cassette('create_url_map') do + run_example('url_map') + end + puts 'checking that url_map is created' + VCR.use_cassette('check_url_map') do + validate_no_flush_calls('url_map') + end + puts 'destroying url_map' + VCR.use_cassette('destroy_url_map') do + run_example('delete_url_map') + end + puts 'confirming url_map destroyed' + VCR.use_cassette('check_destroy_url_map') do + validate_no_flush_calls('delete_url_map') + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5b2b6ad0..5c581846 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,40 +33,19 @@ ENV['TZ'] = 'UTC' -#---------------------------------------------------------- -# Setup code coverage - -require 'simplecov' -SimpleCov.start unless ENV['DISABLE_COVERAGE'] - #---------------------------------------------------------- # Add test path to the search libs $LOAD_PATH.unshift(File.expand_path('.')) $LOAD_PATH.unshift(File.expand_path('./spec/stubs')) +# Add fixtures so that they can be loaded by integration tests. +$LOAD_PATH.unshift(File.expand_path('./spec/fixtures/modules/gauth/lib')) +$LOAD_PATH.unshift(File.expand_path('./spec/fixtures/modules/gcompute/lib')) #---------------------------------------------------------- # Block all network traffic - -require 'network_blocker' - -#---------------------------------------------------------- -# Auto require files - -files = [] -files << 'spec/bundle.rb' -files << 'spec/copyright.rb' -files << 'spec/fake_auth.rb' -files << 'spec/test_constants.rb' -files << File.join('lib', '**', '*.rb') - -# Require all files so we can track them via code coverage -Dir[*files].reject { |p| File.directory? p } - .each do |f| - puts "Auto requiring #{f}" \ - if ENV['RSPEC_DEBUG'] - require f - end +require 'puppetlabs_spec_helper/module_spec_helper' +require 'webmock/rspec' #---------------------------------------------------------- # Setup PuppetSpec to allow executing the Puppet manifests from within tests @@ -97,6 +76,10 @@ module PuppetSpec Puppet::Test::TestHelper.after_all_tests end + c.mock_with :rspec do |conf| + conf.syntax = [:should, :expect] + end + c.before :each do base = PuppetSpec::Files.tmpdir('tmp_settings') Puppet[:vardir] = File.join(base, 'var') @@ -113,11 +96,79 @@ module PuppetSpec c.after :each do Puppet::Test::TestHelper.after_each_test - Dir.stub(:entries) PuppetSpec::Files.cleanup end end +def get_example(example_name) + # This is a little nutty, but we actually put a mocked up + # version of the ruby function for healthchecks at the top + # of the manifest. Any other function which gets used in an + # example is going to need the same treatment. This *IS* + # limiting, not everything that can be expressed in a ruby + # function can be expressed in a puppet function - but see comment + # in integration_spec.rb. We haven't figured out a better way yet. + ex = read_example(example_name) + healthcheck_fn = File.open('spec/fixtures/mock_hc_fn.pp').read + healthcheck_fn + "\n\n" + ex +end + +def read_example(example_name) + # It's not ideal, but puppet unit tests don't support + # these facts-as-variables, so we have to do these + # substitutions ourselves. + File.open("examples/#{example_name}.pp", 'rb').read\ + .gsub('$project', "\"#{ENV['GOOGLE_PROJECT']}\"")\ + .gsub('$cred_path', "\"#{ENV['GOOGLE_CREDENTIALS_PATH']}\"") +end + +def run_example(example_name) + # This function runs an example specified by name (not + # including '.pp'. It generates a puppet environment, + # tricks puppet into feeling semi-initialized by + # compiling the example, catching the failure, then + # compiling it again within the context of the failure, + # and then applies it. + mods = [File.expand_path('.'), File.expand_path('./spec/fixtures/modules/')] + example = get_example(example_name) + test = Puppet::Node::Environment.create(:test, mods) + loaders = Puppet::Pops::Loaders.new(test, true) + Puppet.override(current_environment: test, loaders: loaders) do + begin + compile_to_ral(example) + rescue + apply_with_error_check(example) + end + end +end + +def validate_no_flush_calls(example_name) + # This function is very much like run_example, above, except + # that it also validates that no POST calls are made to a + # google API during the 'flush' step (i.e. 'update if + # necessary' step). + mods = [File.expand_path('.'), File.expand_path('./spec/fixtures/modules/')] + example = get_example(example_name) + test = Puppet::Node::Environment.create(:test, mods) + loaders = Puppet::Pops::Loaders.new(test, true) + Puppet.override(current_environment: test, loaders: loaders) do + begin + compile_to_ral(example) + rescue + apply_compiled_manifest(example) do |res| + if res.provider&.respond_to? 'flush' + # Any request to Google APIs during a flush is not + # acceptable - that means that a diff was detected. + omnistub = stub_request(:any, /google/) + .to_raise("Shouldn't have made network call.") + res.provider.flush + remove_request_stub(omnistub) + end + end + end + end +end + require 'mocha/test_unit' #----------------------------------------------------------