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

Add test and alias for BigQuery Dataset name #125

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/resources/google_bigquery_dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_d
its('friendly_name') { should eq 'A BigQuery dataset test' }
its('location') { should eq 'EU' }
its('description') { should eq 'Test BigQuery dataset description' }
its('name') { should eq 'inspec_gcp_dataset' }
its('default_table_expiration_ms') { should cmp '3600000' }
end

Expand All @@ -34,8 +35,6 @@ end
## Properties
Properties that can be accessed from the `google_bigquery_dataset` resource:

* `name`: Dataset name

* `access`: Access controls on the bucket.

* `domain`: A domain to grant access to. Any users signed in with the domain specified will be granted the specified access
Expand Down
6 changes: 4 additions & 2 deletions libraries/google_bigquery_dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Dataset < GcpResourceBase
desc 'Dataset'
supports platform: 'gcp'

attr_reader :name
attr_reader :access
attr_reader :creation_time
attr_reader :dataset_reference
Expand All @@ -42,7 +41,6 @@ def initialize(params)
end

def parse
@name = @fetched['name']
@access = GoogleInSpec::BigQuery::Property::DatasetAccessArray.parse(@fetched['access'])
@creation_time = @fetched['creationTime']
@dataset_reference = GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(@fetched['datasetReference'])
Expand All @@ -64,6 +62,10 @@ def exists?
[email protected]?
end

def name
dataset_reference&.dataset_id
end

private

def product_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
its('friendly_name') { should eq dataset['friendly_name'] }
its('location') { should eq dataset['location'] }
its('description') { should eq dataset['description'] }
its('name') { should eq dataset['dataset_id'] }
its('default_table_expiration_ms') { should cmp dataset['default_table_expiration_ms'] }
end

Expand Down