From 30b18374fb6fa2eab2a023f3712c3cdf0a608a7e Mon Sep 17 00:00:00 2001 From: Lorenzo Caggioni Date: Sat, 5 Feb 2022 09:11:03 +0100 Subject: [PATCH] Replace DP example tests with the new one. --- .../data_platform_foundations/fixture/main.tf | 17 ++++---- .../fixture/variables.tf | 28 +++++++++---- .../data_platform_foundations/test_plan.py | 14 +++++-- .../data_solutions/dp-foundation/__init__.py | 13 ------ .../dp-foundation/fixture/main.tf | 25 ------------ .../dp-foundation/fixture/variables.tf | 40 ------------------- .../data_solutions/dp-foundation/test_plan.py | 27 ------------- 7 files changed, 40 insertions(+), 124 deletions(-) delete mode 100644 tests/examples/data_solutions/dp-foundation/__init__.py delete mode 100644 tests/examples/data_solutions/dp-foundation/fixture/main.tf delete mode 100644 tests/examples/data_solutions/dp-foundation/fixture/variables.tf delete mode 100644 tests/examples/data_solutions/dp-foundation/test_plan.py diff --git a/tests/examples/data_solutions/data_platform_foundations/fixture/main.tf b/tests/examples/data_solutions/data_platform_foundations/fixture/main.tf index df32f7f7..a5f7378d 100644 --- a/tests/examples/data_solutions/data_platform_foundations/fixture/main.tf +++ b/tests/examples/data_solutions/data_platform_foundations/fixture/main.tf @@ -14,13 +14,12 @@ * limitations under the License. */ -module "test-environment" { - source = "../../../../../examples/data-solutions/data-platform-foundations/01-environment" - billing_account_id = var.billing_account - root_node = var.root_node -} - -module "test-resources" { - source = "../../../../../examples/data-solutions/data-platform-foundations/02-resources" - project_ids = module.test-environment.project_ids +module "test" { + source = "../../../../../examples/data-solutions/dp-foundation/" + organization = { domain : "example.com" } + project_create = { + billing_account_id = "123456-123456-123456" + parent = "folders/12345678" + } + prefix = "prefix" } diff --git a/tests/examples/data_solutions/data_platform_foundations/fixture/variables.tf b/tests/examples/data_solutions/data_platform_foundations/fixture/variables.tf index 6a534739..7dfa52e5 100644 --- a/tests/examples/data_solutions/data_platform_foundations/fixture/variables.tf +++ b/tests/examples/data_solutions/data_platform_foundations/fixture/variables.tf @@ -14,13 +14,27 @@ * limitations under the License. */ -variable "billing_account" { - type = string - default = "123456-123456-123456" +variable "organization" { + type = object({ + domain = string + }) + default = { + domain = "example.com" + } } -variable "root_node" { - description = "The resource name of the parent Folder or Organization. Must be of the form folders/folder_id or organizations/org_id." - type = string - default = "folders/12345678" +variable "prefix" { + type = string + default = "prefix" +} + +variable "project_create" { + type = object({ + billing_account_id = string + parent = string + }) + default = { + billing_account_id = "123456-123456-123456" + parent = "folders/12345678" + } } diff --git a/tests/examples/data_solutions/data_platform_foundations/test_plan.py b/tests/examples/data_solutions/data_platform_foundations/test_plan.py index 8bc43e3f..d2b50c74 100644 --- a/tests/examples/data_solutions/data_platform_foundations/test_plan.py +++ b/tests/examples/data_solutions/data_platform_foundations/test_plan.py @@ -12,8 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import os +import pytest + + +FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixture') + + def test_resources(e2e_plan_runner): "Test that plan works and the numbers of resources is as expected." - modules, resources = e2e_plan_runner() - assert len(modules) == 6 - assert len(resources) == 53 + modules, resources = e2e_plan_runner(FIXTURES_DIR) + assert len(modules) == 37 + assert len(resources) == 280 diff --git a/tests/examples/data_solutions/dp-foundation/__init__.py b/tests/examples/data_solutions/dp-foundation/__init__.py deleted file mode 100644 index 6d6d1266..00000000 --- a/tests/examples/data_solutions/dp-foundation/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/tests/examples/data_solutions/dp-foundation/fixture/main.tf b/tests/examples/data_solutions/dp-foundation/fixture/main.tf deleted file mode 100644 index a5f7378d..00000000 --- a/tests/examples/data_solutions/dp-foundation/fixture/main.tf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -module "test" { - source = "../../../../../examples/data-solutions/dp-foundation/" - organization = { domain : "example.com" } - project_create = { - billing_account_id = "123456-123456-123456" - parent = "folders/12345678" - } - prefix = "prefix" -} diff --git a/tests/examples/data_solutions/dp-foundation/fixture/variables.tf b/tests/examples/data_solutions/dp-foundation/fixture/variables.tf deleted file mode 100644 index 7dfa52e5..00000000 --- a/tests/examples/data_solutions/dp-foundation/fixture/variables.tf +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -variable "organization" { - type = object({ - domain = string - }) - default = { - domain = "example.com" - } -} - -variable "prefix" { - type = string - default = "prefix" -} - -variable "project_create" { - type = object({ - billing_account_id = string - parent = string - }) - default = { - billing_account_id = "123456-123456-123456" - parent = "folders/12345678" - } -} diff --git a/tests/examples/data_solutions/dp-foundation/test_plan.py b/tests/examples/data_solutions/dp-foundation/test_plan.py deleted file mode 100644 index d2b50c74..00000000 --- a/tests/examples/data_solutions/dp-foundation/test_plan.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import os -import pytest - - -FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixture') - - -def test_resources(e2e_plan_runner): - "Test that plan works and the numbers of resources is as expected." - modules, resources = e2e_plan_runner(FIXTURES_DIR) - assert len(modules) == 37 - assert len(resources) == 280