Skip to content

Commit

Permalink
update test case& readme
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <[email protected]>
  • Loading branch information
balasubramanian-s committed Oct 17, 2024
1 parent e2844be commit 58c6c3b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ The following resources are available in the InSpec GCP Profile
| [google_logging_project_sink](docs/resources/google_logging_project_sink.md) | [google_logging_project_sinks](docs/resources/google_logging_project_sinks.md) |
| [google_memcache_instance](docs/resources/google_memcache_instance.md) | [google_memcache_instances](docs/resources/google_memcache_instances.md) |
| [google_ml_engine_model](docs/resources/google_ml_engine_model.md) | [google_ml_engine_models](docs/resources/google_ml_engine_models.md) |
| [google_monitoring_group](docs/resources/google_monitoring_group.md) | [google_monitoring_groups](docs/resources/google_monitoring_groups.md) |
| [google_organization](docs/resources/google_organization.md) | [google_organizations](docs/resources/google_organizations.md) |
| No Singular Resource | [google_orgpolicy_folder_constraints](docs/resources/google_orgpolicy_folder_constraints.md) |
| No Singular Resource | [google_orgpolicy_organization_constraints](docs/resources/google_orgpolicy_project_constraints.md) |
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/google_monitoring_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A `google_monitoring_groups` is used to test a Google Group resource

## Examples
```
describe google_monitoring_groups(name: 'value_name') do
describe google_monitoring_groups(name: 'projects/*') do
it { should exist }
its('names') { should include 'value_name' }
its('display_names') { should include 'value_displayname' }
Expand Down
12 changes: 5 additions & 7 deletions test/integration/verify/controls/google_monitoring_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

group = input('group', value: {
"name": "value_name",
"display_name": "value_displayname",
"parent_name": "value_parentname",
"filter": "value_filter"
group = input('group', value: {
"name": "projects/ppradhan/groups/1973775459523949291",
"display_name": "inspec-test-group",
"parent_name": "projects/ppradhan",
"filter": "resource.metadata.name = has_substring(\"inspec\")"
}, description: 'group description')
control 'google_monitoring_group-1.0' do
impact 1.0
Expand All @@ -30,9 +30,7 @@
it { should exist }
its('name') { should cmp group['name'] }
its('display_name') { should cmp group['display_name'] }
its('parent_name') { should cmp group['parent_name'] }
its('filter') { should cmp group['filter'] }

end

describe google_monitoring_group(name: "does_not_exit") do
Expand Down
15 changes: 9 additions & 6 deletions test/integration/verify/controls/google_monitoring_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

group = input('group', value: {
"name": "value_name",
"display_name": "value_displayname",
"parent_name": "value_parentname",
"filter": "value_filter"
group = input('group', value: {
"name": "projects/ppradhan/groups/1973775459523949291",
"display_name": "inspec-test-group",
"parent_name": "projects/ppradhan",
"filter": "resource.metadata.name = has_substring(\"inspec\")"
}, description: 'group description')
control 'google_monitoring_groups-1.0' do
impact 1.0
title 'google_monitoring_groups resource test'

describe google_monitoring_groups(name: group['name']) do
describe google_monitoring_groups(name: group['name']) do
it { should exist }
its('names') { should include group['name'] }
its('display_names') { should include group['display_name'] }
its('filters') { should include group['filter'] }
end
end

0 comments on commit 58c6c3b

Please sign in to comment.