Skip to content

Commit

Permalink
added tf scripts & updated test cases
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <[email protected]>
  • Loading branch information
balasubramanian-s committed Jul 23, 2024
1 parent b60946f commit 5d859a2
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 108 deletions.
5 changes: 2 additions & 3 deletions docs/resources/google_dataproc_metastore_federation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A `google_dataproc_metastore_federation` is used to test a Google Federation res

## Examples
```
describe google_dataproc_metastore_federation(name: ' value_name') do
describe google_dataproc_metastore_federation(name: 'value_name') do
it { should exist }
its('name') { should cmp 'value_name' }
its('create_time') { should cmp 'value_createtime' }
Expand All @@ -33,7 +33,6 @@ describe google_dataproc_metastore_federation(name: ' value_name') do
its('state') { should cmp 'value_state' }
its('state_message') { should cmp 'value_statemessage' }
its('uid') { should cmp 'value_uid' }
end
describe google_dataproc_metastore_federation(name: "does_not_exit") do
Expand All @@ -56,7 +55,7 @@ Properties that can be accessed from the `google_dataproc_metastore_federation`

* `labels`: User-defined labels for the metastore federation.

* `additional_properties`:
* `additional_properties`:

* `version`: Immutable. The Apache Hive metastore version of the federation. All backend metastore versions must be compatible with the federation version.

Expand Down
10 changes: 9 additions & 1 deletion docs/resources/google_dataproc_metastore_federations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ A `google_dataproc_metastore_federations` is used to test a Google Federation re

## Examples
```
describe google_dataproc_metastore_federations(parent: ' value_parent') do
describe google_dataproc_metastore_federations(parent: 'value_parent') do
it { should exist }
its('names') { should include 'value_name' }
its('create_times') { should include 'value_createtime' }
its('update_times') { should include 'value_updatetime' }
its('versions') { should include 'value_version' }
its('endpoint_uris') { should include 'value_endpointuri' }
its('states') { should include 'value_state' }
its('state_messages') { should include 'value_statemessage' }
its('uids') { should include 'value_uid' }
end
```

Expand Down
2 changes: 1 addition & 1 deletion libraries/google_dataproc_metastore_federation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def to_s
private

def product_url(_ = nil)
'https://metastore.googleapis.com/v1beta/'
'https://metastore.googleapis.com/v1/'
end

def resource_base_url
Expand Down
2 changes: 1 addition & 1 deletion libraries/google_dataproc_metastore_federations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def transformers
private

def product_url(_ = nil)
'https://metastore.googleapis.com/v1beta/'
'https://metastore.googleapis.com/v1/'
end

def resource_base_url
Expand Down
38 changes: 23 additions & 15 deletions test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ variable "bigtable_instance_cluster" {
variable "dataproc_metastore_service" {
type = any
}
variable "dataproc_metastore_federation" {
type = any
}

resource "google_compute_ssl_policy" "custom-ssl-policy" {
name = var.ssl_policy["name"]
Expand Down Expand Up @@ -1724,7 +1727,7 @@ resource "google_secret_manager_secret" "test-secret" {
secret_id = var.secrets_manager_v1["secret_id"]

replication {
auto {}
# auto {}
}
}

Expand Down Expand Up @@ -2175,23 +2178,28 @@ resource "google_bigtable_instance" "inspec-test" {
my-label = var.bigtable_instance_cluster.name
}
}
resource "google_dataproc_metastore_service" "default" {
project = var.gcp_project_id
service_id = var.dataproc_metastore_service.name
location = var.dataproc_metastore_service.location
port = var.dataproc_metastore_service.port
tier = var.dataproc_metastore_service.tier

maintenance_window {
hour_of_day = 2
day_of_week = "SUNDAY"
}
resource "google_dataproc_metastore_service" "inspec-test" {
project = var.gcp_project_id
service_id = var.dataproc_metastore_service.name
location = var.dataproc_metastore_service.location
tier = var.dataproc_metastore_service.tier


hive_metastore_config {
version = var.dataproc_metastore_service.hive_config_version
version = var.dataproc_metastore_service.version
# endpoint_protocol = "GRPC"
}

labels = {
env = "inspec"
}
resource "google_dataproc_metastore_federation" "inspec-federation" {
project = var.gcp_project_id
location = var.dataproc_metastore_federation.location
federation_id = var.dataproc_metastore_federation.federation_id
version = var.dataproc_metastore_federation.version

backend_metastores {
rank = "1"
name = google_dataproc_metastore_service.inspec-test.id
metastore_type = var.dataproc_metastore_service.metastore_type
}
}
8 changes: 6 additions & 2 deletions test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,10 @@ bigtable_instance_cluster:
dataproc_metastore_service:
name: "metastore-srv"
location: "us-central1"
port: 9080
tier: "DEVELOPER"
hive_config_version: "2.3.6"
version: "3.1.2"
metastore_type: "DATAPROC_METASTORE"

dataproc_metastore_federation:
federation_id: "inspec-federation"
location: "us-central1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------

title 'Test GCP google_dataproc_metastore_federation resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')
federation = input('federation', value: {
"name": "projects/ppradhan/locations/us-central1/federations/inspec-federation",
"parent": "projects/ppradhan/locations/us-central1",
"create_time": "2024-07-23T11:59:46.629125267Z",
"update_time": "2024-07-23T12:01:30.424230443Z",
"version": "3.1.2",
"endpoint_uri": "https://standalone-federation-inspec-federation-4082ad6a-ct6cldpepa-uc.a.run.app:443",
"state": "ACTIVE",
"state_message": "value_statemessage",
"uid": "d9600d29-81c5-47f1-8db6-4ffe194841fe"
}, description: 'federation description')
control 'google_dataproc_metastore_federation-1.0' do
impact 1.0
title 'google_dataproc_metastore_federation resource test'

describe google_dataproc_metastore_federation(name: federation['name']) do
it { should exist }
its('name') { should cmp federation['name'] }
its('create_time') { should cmp federation['create_time'] }
its('update_time') { should cmp federation['update_time'] }
its('version') { should cmp federation['version'] }
its('endpoint_uri') { should cmp federation['endpoint_uri'] }
its('state') { should cmp federation['state'] }
its('state_message') { should cmp federation['state_message'] }
its('uid') { should cmp federation['uid'] }

end

describe google_dataproc_metastore_federation(name: "does_not_exit") do
it { should_not exist }
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------

title 'Test GCP google_dataproc_metastore_federations resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')
federation = input('federation', value: {
"name": "projects/ppradhan/locations/us-central1/federations/inspec-federation",
"parent": "projects/ppradhan/locations/us-central1",
"create_time": "2024-07-23T11:59:46.629125267Z",
"update_time": "2024-07-23T12:01:30.424230443Z",
"version": "3.1.2",
"endpoint_uri": "https://standalone-federation-inspec-federation-4082ad6a-ct6cldpepa-uc.a.run.app:443",
"state": "ACTIVE",
"state_message": "value_statemessage",
"uid": "d9600d29-81c5-47f1-8db6-4ffe194841fe"
}, description: 'federation description')
control 'google_dataproc_metastore_federations-1.0' do
impact 1.0
title 'google_dataproc_metastore_federations resource test'

describe google_dataproc_metastore_federations(parent: federation['parent']) do
it { should exist }
its('names') { should include federation['name'] }
its('create_times') { should include federation['create_time'] }
its('update_times') { should include federation['update_time'] }
its('versions') { should include federation['version'] }
its('endpoint_uris') { should include federation['endpoint_uri'] }
its('states') { should include federation['state'] }
its('uids') { should include federation['uid'] }
end
end

This file was deleted.

This file was deleted.

0 comments on commit 5d859a2

Please sign in to comment.