From 15e5904966ee9bbf1b173817780b855d3e6b561f Mon Sep 17 00:00:00 2001 From: Lorenzo Caggioni Date: Wed, 13 Apr 2022 15:08:37 +0200 Subject: [PATCH] Add example test --- .../cloudsql-multiregion/__init__.py | 13 +++++++++ .../cloudsql-multiregion/fixture/main.tf | 27 +++++++++++++++++++ .../cloudsql-multiregion/test_plan.py | 19 +++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 tests/examples/data_solutions/cloudsql-multiregion/__init__.py create mode 100644 tests/examples/data_solutions/cloudsql-multiregion/fixture/main.tf create mode 100644 tests/examples/data_solutions/cloudsql-multiregion/test_plan.py diff --git a/tests/examples/data_solutions/cloudsql-multiregion/__init__.py b/tests/examples/data_solutions/cloudsql-multiregion/__init__.py new file mode 100644 index 00000000..6d6d1266 --- /dev/null +++ b/tests/examples/data_solutions/cloudsql-multiregion/__init__.py @@ -0,0 +1,13 @@ +# 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/cloudsql-multiregion/fixture/main.tf b/tests/examples/data_solutions/cloudsql-multiregion/fixture/main.tf new file mode 100644 index 00000000..7c709550 --- /dev/null +++ b/tests/examples/data_solutions/cloudsql-multiregion/fixture/main.tf @@ -0,0 +1,27 @@ +/** + * 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/cloudsql-multiregion/" + data_eng_principals = ["dataeng@example.com"] + postgres_user_password = "my-root-password" + project_id = "project" + project_create = { + billing_account_id = "123456-123456-123456" + parent = "folders/12345678" + } + prefix = "prefix" +} diff --git a/tests/examples/data_solutions/cloudsql-multiregion/test_plan.py b/tests/examples/data_solutions/cloudsql-multiregion/test_plan.py new file mode 100644 index 00000000..1aa11e26 --- /dev/null +++ b/tests/examples/data_solutions/cloudsql-multiregion/test_plan.py @@ -0,0 +1,19 @@ +# 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. + +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) == 11 + assert len(resources) == 49