Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Clean up tests to prevent extra variables
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Levenick <[email protected]>
  • Loading branch information
slevenick committed Sep 6, 2019
1 parent 3954396 commit 35449ba
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion libraries/gcp_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def initialize(link, cred, request_type)
end

def builder
Net::HTTP.const_get(request_type)
Net::HTTP.const_get(@request_type)
end

def send
Expand Down
4 changes: 2 additions & 2 deletions test/integration/build/gcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ resource "google_compute_region_instance_group_manager" "appserver" {
resource "google_container_cluster" "primary" {
project = "${var.gcp_project_id}"
name = "${var.gcp_kube_cluster_name}"
zone = "${var.gcp_kube_cluster_zone}"
location = "${var.gcp_kube_cluster_zone}"
initial_node_count = "${var.gcp_kube_cluster_size}"

additional_zones = [
node_locations = [
"${var.gcp_kube_cluster_zone_extra1}",
"${var.gcp_kube_cluster_zone_extra2}",
]
Expand Down
3 changes: 0 additions & 3 deletions test/integration/configuration/gcp_inspec_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def self.add_random_string(length = 25)
# Determine the storage account name and the admin password
:gcp_location => "europe-west2",
:gcp_zone => "europe-west2-a",
:gcp_zone_id => "2290",
:gcp_region_id => "1290",
# Cloud functions are only available in certain regions
:gcp_cloud_function_region => "us-central1",
:gcp_int_vm_name => "gcp-inspec-int-linux-vm",
Expand Down Expand Up @@ -76,7 +74,6 @@ def self.add_random_string(length = 25)
:gcp_kube_cluster_master_user => "gcp-inspec-kube-admin",
:gcp_kube_cluster_master_pass => (("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a + %w{! @ # $ % & / ( ) + ? *}).sample(20).join,
:gcp_kube_nodepool_name => "default-pool",
:gcp_inspec_user_email => "user:[email protected]",
:gcp_kms_key_ring_policy_name => "gcp-inspec-kms-key-ring-#{add_random_string}",
:gcp_kms_key_ring_binding_member_name => "gcp-inspec-kms-key-ring-#{add_random_string}",
:gcp_kms_crypto_key_name_policy => "gcp-inspec-kms-crypto-key-policy-#{add_random_string}",
Expand Down
1 change: 0 additions & 1 deletion test/integration/verify/controls/google_compute_region.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.')
gcp_location = attribute(:gcp_location, default: 'gcp_location', description: 'The GCP project region.')
gcp_region_id = attribute(:gcp_region_id, default: 'gcp_region_id', description: 'A sample GCP region identifier to test for.')
control 'google_compute_region-1.0' do
impact 1.0
title 'google_compute_region resource test'
Expand Down
3 changes: 1 addition & 2 deletions test/integration/verify/controls/google_compute_regions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.')
gcp_location = attribute(:gcp_location, default: 'gcp_location', description: 'The GCP project region.')
gcp_region_id = attribute(:gcp_region_id, default: 'gcp_region_id', description: 'A sample GCP region identifier to test for.')
control 'google_compute_regions-1.0' do
impact 1.0
title 'google_compute_regions resource test'
Expand All @@ -25,6 +24,6 @@
its('count') { should be >= 1 }
its('region_names') { should include "#{gcp_location}" }
its('region_statuses') { should_not include "DOWN" }
its('region_ids') { should include gcp_region_id }
its('region_ids') { should include "1290" }
end
end
3 changes: 1 addition & 2 deletions test/integration/verify/controls/google_compute_zones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

gcp_project_id = attribute(:gcp_project_id, default: '', description: 'The GCP project identifier.')
gcp_zone = attribute(:gcp_zone, default: '', description: 'The GCP zone being used.')
gcp_zone_id = attribute(:gcp_zone_id, default: '', description: 'A sample zone identifier to test for.')

control 'gcp-zones-1.0' do

Expand All @@ -14,7 +13,7 @@
its('count') { should be <= 100} # 46 at the time of writing
its('zone_names') { should include gcp_zone }
its('zone_statuses') { should_not include "DOWN" }
its('zone_ids') { should include gcp_zone_id.to_i }
its('zone_ids') { should include 2290 }
end

end

0 comments on commit 35449ba

Please sign in to comment.