-
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.
Add HTTPS health check to InSpec (#1305)
Merged PR #1305.
- Loading branch information
1 parent
74d2bbd
commit a487049
Showing
7 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
Submodule inspec
updated
8 files
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
2 changes: 2 additions & 0 deletions
2
templates/inspec/examples/attributes/google_compute_https_health_check.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,2 @@ | ||
gcp_project_id = attribute(:gcp_project_id, default: '<%= external_attribute('gcp_project_id') -%>', description: 'The GCP project identifier.') | ||
https_health_check = attribute('https_health_check', default: <%= JSON.pretty_generate(grab_attributes['https_health_check']) -%>, description: 'HTTPS health check definition') |
13 changes: 13 additions & 0 deletions
13
templates/inspec/examples/google_compute_https_health_check.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,13 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% https_health_check = grab_attributes['https_health_check'] -%> | ||
describe google_compute_https_health_check(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, name: <%= doc_generation ? "'#{https_health_check['name']}'" : "https_health_check['name']" -%>) do | ||
it { should exist } | ||
its('timeout_sec') { should eq <%= doc_generation ? "'#{https_health_check['timeout_sec']}'" : "https_health_check['timeout_sec']" -%> } | ||
its('request_path') { should eq <%= doc_generation ? "'#{https_health_check['request_path']}'" : "https_health_check['request_path']" -%> } | ||
its('check_interval_sec') { should eq <%= doc_generation ? "'#{https_health_check['check_interval_sec']}'" : "https_health_check['check_interval_sec']" -%> } | ||
its('unhealthy_threshold') { should eq <%= doc_generation ? "'#{https_health_check['unhealthy_threshold']}'" : "https_health_check['unhealthy_threshold']" -%> } | ||
end | ||
|
||
describe google_compute_https_health_check(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, name: 'nonexistent') do | ||
it { should_not exist } | ||
end |
7 changes: 7 additions & 0 deletions
7
templates/inspec/examples/google_compute_https_health_checks.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,7 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% https_health_check = grab_attributes['https_health_check'] -%> | ||
describe google_compute_https_health_checks(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>) do | ||
its('names') { should include <%= doc_generation ? "'#{https_health_check['name']}'" : "https_health_check['name']" -%> } | ||
its('timeout_secs') { should include <%= doc_generation ? "'#{https_health_check['timeout_sec']}'" : "https_health_check['timeout_sec']" -%> } | ||
its('check_interval_secs') { should include <%= doc_generation ? "'#{https_health_check['check_interval_sec']}'" : "https_health_check['check_interval_sec']" -%> } | ||
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