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

Commit

Permalink
Add test and alias for BigQuery Dataset name
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
slevenick authored and modular-magician committed Mar 13, 2019
1 parent baa73be commit 5465f7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
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?
!@fetched.nil?
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

0 comments on commit 5465f7e

Please sign in to comment.