Skip to content

Commit

Permalink
update testcases
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <[email protected]>
  • Loading branch information
balasubramanian-s committed Jun 27, 2024
1 parent 331e08d commit b8e83a9
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 114 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ The following resources are available in the InSpec GCP Profile
| [google_dataflow_project_location_job](docs/resources/google_dataflow_project_location_job.md) | [google_dataflow_project_location_jobs](docs/resources/google_dataflow_project_location_jobs.md) |
| [google_dataproc_autoscaling_policy](docs/resources/google_dataproc_autoscaling_policy.md) | [google_dataproc_autoscaling_policies](docs/resources/google_dataproc_autoscaling_policies.md) |
| [google_dataproc_cluster](docs/resources/google_dataproc_cluster.md) | [google_dataproc_clusters](docs/resources/google_dataproc_clusters.md) |
| [google_dataproc_job](docs/resources/google_dataproc_job.md) | [google_dataproc_jobs](docs/resources/google_dataproc_jobs.md) |
| [google_dataproc_workflow_template](docs/resources/google_dataproc_workflow_template.md) | [google_dataproc_workflow_templates](docs/resources/google_dataproc_workflow_templates.md) |
| [google_dns_managed_zone](docs/resources/google_dns_managed_zone.md) | [google_dns_managed_zones](docs/resources/google_dns_managed_zones.md) |
| [google_dns_resource_record_set](docs/resources/google_dns_resource_record_set.md) | [google_dns_resource_record_sets](docs/resources/google_dns_resource_record_sets.md) |
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,59 +1,21 @@
+++

---
title = "google_dataproc_jobs Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "google_dataproc_jobs"
identifier = "inspec/resources/gcp/google_dataproc_jobs Resource"
parent = "inspec/resources/gcp"
+++

Use the `google_dataproc_jobs` InSpec audit resource to test the properties of a test a Google Job.

## Installation
{{% inspec_gcp_install %}}
---

## Syntax
A `google_dataproc_jobs` is used to test a Google Job resource

## Examples
```
describe google_dataproc_jobs() do
describe google_dataproc_jobs(project_id: 'value_project_id', region: 'value_region') do
it { should exist }
its('driver_output_resource_uris') { should include 'value_driveroutputresourceuri' }
its('driver_control_files_uris') { should include 'value_drivercontrolfilesuri' }
its('job_uuids') { should include 'value_jobuuid' }
end
```

## Parameters
Properties that can be accessed from the `google_dataproc_jobs` resource:

See [google_dataproc_job.md](google_dataproc_job.md) for more detailed information
* `references`: an array of `google_dataproc_job` reference
* `placements`: an array of `google_dataproc_job` placement
* `hadoop_jobs`: an array of `google_dataproc_job` hadoop_job
* `spark_jobs`: an array of `google_dataproc_job` spark_job
* `pyspark_jobs`: an array of `google_dataproc_job` pyspark_job
* `hive_jobs`: an array of `google_dataproc_job` hive_job
* `pig_jobs`: an array of `google_dataproc_job` pig_job
* `spark_r_jobs`: an array of `google_dataproc_job` spark_r_job
* `spark_sql_jobs`: an array of `google_dataproc_job` spark_sql_job
* `presto_jobs`: an array of `google_dataproc_job` presto_job
* `trino_jobs`: an array of `google_dataproc_job` trino_job
* `flink_jobs`: an array of `google_dataproc_job` flink_job
* `statuses`: an array of `google_dataproc_job` status
* `status_histories`: an array of `google_dataproc_job` status_history
* `yarn_applications`: an array of `google_dataproc_job` yarn_applications
* `driver_output_resource_uris`: an array of `google_dataproc_job` driver_output_resource_uri
* `driver_control_files_uris`: an array of `google_dataproc_job` driver_control_files_uri
* `labels`: an array of `google_dataproc_job` labels
* `schedulings`: an array of `google_dataproc_job` scheduling
* `job_uuids`: an array of `google_dataproc_job` job_uuid
* `dones`: an array of `google_dataproc_job` done
* `driver_scheduling_configs`: an array of `google_dataproc_job` driver_scheduling_config
## Properties
Properties that can be accessed from the `google_dataproc_jobs` resource:

Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 9 additions & 10 deletions test/integration/verify/controls/google_dataproc_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,26 @@

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

job = input('job', value: {
"job_id": "value_jobid",
"project_id": "value_projectid",
"region": "value_region",
"driver_output_resource_uri": "value_driveroutputresourceuri",
"driver_control_files_uri": "value_drivercontrolfilesuri",
"job_uuid": "value_jobuuid"
job = input('job', value: {
"job_id": "job-46b1a728",
"project_id": "ppradhan",
"region": "europe-west2",
"driver_output_resource_uri": "gs://dataproc-staging-europe-west2-165434197229-ycz8tbcn/google-cloud-dataproc-metainfo/0c01e2dd-85d5-4bac-9e53-b7c4ebd1c6b8/jobs/job-46b1a728/driveroutput",
"driver_control_files_uri": "gs://dataproc-staging-europe-west2-165434197229-ycz8tbcn/google-cloud-dataproc-metainfo/0c01e2dd-85d5-4bac-9e53-b7c4ebd1c6b8/jobs/job-46b1a728/",
"job_uuid": "96a1cb4b-1083-416b-ac8a-3ebd39e478c3"
}, description: 'job description')
control 'google_dataproc_job-1.0' do
impact 1.0
title 'google_dataproc_job resource test'

describe google_dataproc_job(jobId: job['jobId'], projectId: job['projectId'], region: job['region']) do
describe google_dataproc_job(job_id: job['job_id'], project_id: job['project_id'], region: job['region']) do
it { should exist }
its('driver_output_resource_uri') { should cmp job['driver_output_resource_uri'] }
its('driver_control_files_uri') { should cmp job['driver_control_files_uri'] }
its('job_uuid') { should cmp job['job_uuid'] }

end

describe google_dataproc_job(jobId: job['jobId'], projectId: job['projectId'], region: job['region']) do
describe google_dataproc_job(job_id: job['jobId'], project_id: job['project_id'], region: job['region']) do
it { should_not exist }
end
end
19 changes: 11 additions & 8 deletions test/integration/verify/controls/google_dataproc_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@

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

job = input('job', value: {
"job_id": "value_jobid",
"project_id": "value_projectid",
"region": "value_region",
"driver_output_resource_uri": "value_driveroutputresourceuri",
"driver_control_files_uri": "value_drivercontrolfilesuri",
"job_uuid": "value_jobuuid"
job = input('job', value: {
"job_id": "job-46b1a728",
"project_id": "ppradhan",
"region": "europe-west2",
"driver_output_resource_uri": "gs://dataproc-staging-europe-west2-165434197229-ycz8tbcn/google-cloud-dataproc-metainfo/0c01e2dd-85d5-4bac-9e53-b7c4ebd1c6b8/jobs/job-46b1a728/driveroutput",
"driver_control_files_uri": "gs://dataproc-staging-europe-west2-165434197229-ycz8tbcn/google-cloud-dataproc-metainfo/0c01e2dd-85d5-4bac-9e53-b7c4ebd1c6b8/jobs/job-46b1a728/",
"job_uuid": "96a1cb4b-1083-416b-ac8a-3ebd39e478c3"
}, description: 'job description')
control 'google_dataproc_jobs-1.0' do
impact 1.0
title 'google_dataproc_jobs resource test'

describe google_dataproc_jobs() do
describe google_dataproc_jobs(project_id: job['project_id'], region: job['region']) do
it { should exist }
its('driver_output_resource_uris') { should include job['driver_output_resource_uri'] }
its('driver_control_files_uris') { should include job['driver_control_files_uri'] }
its('job_uuids') { should include job['job_uuid'] }
end
end

0 comments on commit b8e83a9

Please sign in to comment.