-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
templates/inspec/examples/attributes/google_compute_url_map.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
gcp_project_id = attribute(:gcp_project_id, default: '<%= external_attribute('gcp_project_id') -%>', description: 'The GCP project identifier.') | ||
url_map = attribute('url_map', default: <%= JSON.pretty_generate(grab_attributes['url_map']) -%>, description: 'Compute URL map definition') | ||
backend_service = attribute('backend_service', default: <%= JSON.pretty_generate(grab_attributes['backend_service']) -%>, description: 'Backend service definition') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% url_map = grab_attributes['url_map'] -%> | ||
<% backend_service = grab_attributes['backend_service'] -%> | ||
describe google_compute_url_map(project: <%= gcp_project_id -%>, name: <%= doc_generation ? "'#{url_map['name']}'" : "url_map['name']" -%>) do | ||
it { should exist } | ||
its('description') { should eq <%= doc_generation ? "'#{url_map['description']}'" : "url_map['description']" -%> } | ||
its('default_service') { should match /\/<%= "#{grab_attributes['backend_service']['name']}" -%>$/ } | ||
its('host_rules.count') { should eq 1 } | ||
its('host_rules.first.hosts') { should include <%= doc_generation ? "'#{url_map['host_rule_host']}'" : "url_map['host_rule_host']" -%> } | ||
its('path_matchers.count') { should eq 1 } | ||
its('path_matchers.first.default_service') { should match /\/<%= "#{grab_attributes['backend_service']['name']}" -%>$/ } | ||
its('tests.count') { should eq 1 } | ||
its('tests.first.host') { should eq <%= doc_generation ? "'#{url_map['test_host']}'" : "url_map['test_host']" -%> } | ||
its('tests.first.path') { should eq <%= doc_generation ? "'#{url_map['test_path']}'" : "url_map['test_path']" -%> } | ||
end | ||
|
||
describe google_compute_url_map(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, name: 'nonexistent') do | ||
it { should_not exist } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% url_map = grab_attributes['url_map'] -%> | ||
<% backend_service = grab_attributes['backend_service'] -%> | ||
describe google_compute_url_maps(project: <%= gcp_project_id -%>) do | ||
its('names') { should include <%= doc_generation ? "'#{url_map['name']}'" : "url_map['name']" -%> } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters