Skip to content

Commit

Permalink
Updates pubsub tests
Browse files Browse the repository at this point in the history
Signed-off-by: jnahelou <[email protected]>
  • Loading branch information
jnahelou committed Jan 8, 2019
1 parent 5b3b46b commit 3fd41e6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ resource "google_pubsub_subscription" "default" {
project = "${var.gcp_project_id}"
name = "${var.subscription["name"]}"
topic = "${google_pubsub_topic.topic.name}"
ack_deadline_seconds = 20
ack_deadline_seconds = "${var.subscription["ack_deadline_seconds"]}"
}
2 changes: 2 additions & 0 deletions test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ topic:
name: 'inspec-gcp-topic'
subscription:
name: 'inspec-gcp-subscription'
ack_deadline_seconds: 20

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

title 'Test GCP google_pubsub_subscription resource.'

gcp_project_id = attribute(:gcp_gcp_project_id, default: '', description: 'The GCP project identifier.')
subscription = attribute('subscription', default: {"name"=>"inspec-gcp-subscription"})
gcp_project_id = attribute(:gcp_project_id, default: '', description: 'The GCP project identifier.')
subscription = attribute('subscription', default: {"name"=>"inspec-gcp-subscription", "ack_deadline_seconds"=>20})

control 'google_pubsub_subscription-1.0' do
impact 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@

title 'Test GCP google_pubsub_subscriptions resource.'

gcp_project_id = attribute(:gcp_gcp_project_id, default: '', description: 'The GCP project identifier.')
subscription = attribute('subscription', default: {"name"=>"inspec-gcp-subscription"})
gcp_project_id = attribute(:gcp_project_id, default: '', description: 'The GCP project identifier.')
subscription = attribute('subscription', default: {"name"=>"inspec-gcp-subscription", "ack_deadline_seconds"=>20})

control 'google_pubsub_subscriptions-1.0' do
impact 1.0
title 'google_pubsub_subscriptions resource test'

describe google_pubsub_subscriptions(project: gcp_project_id) do
it { should exist }
its('names') { should include topic['name'] }
its('count') { should eq 1 }
end

google_pubsub_subscriptions(project: gcp_project_id).names.each do |subscription_name|
describe google_pubsub_topic(project: gcp_project_id, name: subscription_name) do
its('name') { should eq topic['name'] }
describe google_pubsub_subscription(project: gcp_project_id, name: subscription_name) do
its('name') { should match /#{subscription['name']}/ }
end
end
end
2 changes: 1 addition & 1 deletion test/integration/verify/controls/google_pubsub_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

title 'Test GCP google_pubsub_topic resource.'

gcp_project_id = attribute(:gcp_gcp_project_id, default: '', description: 'The GCP project identifier.')
gcp_project_id = attribute(:gcp_project_id, default: '', description: 'The GCP project identifier.')
topic = attribute('topic', default: {"name"=>"inspec-gcp-topic"})

control 'google_pubsub_topic-1.0' do
Expand Down
2 changes: 1 addition & 1 deletion test/integration/verify/controls/google_pubsub_topics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

title 'Test GCP google_pubsub_topics resource.'

gcp_project_id = attribute(:gcp_gcp_project_id, default: '', description: 'The GCP project identifier.')
gcp_project_id = attribute(:gcp_project_id, default: '', description: 'The GCP project identifier.')
topic = attribute('topic', default: {"name"=>"inspec-gcp-topic"})

control 'google_pubsub_topics-1.0' do
Expand Down

0 comments on commit 3fd41e6

Please sign in to comment.