-
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 bigquery table, refactor nested objects to namespace properly
- Loading branch information
Showing
8 changed files
with
88 additions
and
11 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
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
14 changes: 14 additions & 0 deletions
14
templates/inspec/examples/google_bigquery_table/google_bigquery_table.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,14 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% bigquery_table = grab_attributes['bigquery_table'] -%> | ||
<% dataset = grab_attributes['dataset'] -%> | ||
describe google_bigquery_table(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, dataset: <%= doc_generation ? "'#{dataset['dataset_id']}'" : "dataset['dataset_id']" -%>, name: <%= doc_generation ? "'#{bigquery_table['table_id']}'" : "bigquery_table['table_id']" -%>) do | ||
it { should exist } | ||
|
||
its('expiration_time') { should cmp <%= doc_generation ? "'#{bigquery_table['expiration_time']}'" : "bigquery_table['expiration_time']" -%> } | ||
its('time_partitioning.type') { should eq <%= doc_generation ? "'#{bigquery_table['time_partitioning_type']}'" : "bigquery_table['time_partitioning_type']" -%> } | ||
its('description') { should eq <%= doc_generation ? "'#{bigquery_table['description']}'" : "bigquery_table['description']" -%> } | ||
end | ||
|
||
describe google_bigquery_table(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, dataset: <%= doc_generation ? "'#{dataset['dataset_id']}'" : "dataset['dataset_id']" -%>, name: 'nonexistent') do | ||
it { should_not exist } | ||
end |
3 changes: 3 additions & 0 deletions
3
templates/inspec/examples/google_bigquery_table/google_bigquery_table_attributes.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.') | ||
bigquery_table = attribute('bigquery_table', default: <%= JSON.pretty_generate(grab_attributes['bigquery_table']) -%>, description: 'BigQuery table definition') | ||
dataset = attribute('dataset', default: <%= JSON.pretty_generate(grab_attributes['dataset']) -%>, description: 'BigQuery dataset definition') |
11 changes: 11 additions & 0 deletions
11
templates/inspec/examples/google_bigquery_table/google_bigquery_tables.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,11 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% bigquery_table = grab_attributes['bigquery_table'] -%> | ||
<% dataset = grab_attributes['dataset'] -%> | ||
describe.one do | ||
google_bigquery_tables(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, dataset: <%= doc_generation ? "'#{dataset['dataset_id']}'" : "dataset['dataset_id']" -%>).table_references.each do |table_reference| | ||
describe google_bigquery_table(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, dataset: <%= doc_generation ? "'#{dataset['dataset_id']}'" : "dataset['dataset_id']" -%>, name: table_reference.table_id) do | ||
its('expiration_time') { should cmp <%= doc_generation ? "'#{bigquery_table['expiration_time']}'" : "bigquery_table['expiration_time']" -%> } | ||
its('description') { should eq <%= doc_generation ? "'#{bigquery_table['description']}'" : "bigquery_table['description']" -%> } | ||
end | ||
end | ||
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
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