From 3c88315f6e2e8f13e9f831337cb16e324833cfa7 Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Wed, 8 Feb 2023 21:48:28 +0100 Subject: [PATCH] Update tests for hub and spoke blueprints --- .../hub-and-spoke-peering/README.md | 17 ++++++++++++ .../networking/hub-and-spoke-vpn/README.md | 15 +++++++++++ .../hub_and_spoke_peering/__init__.py | 13 ---------- .../hub_and_spoke_peering/fixture/main.tf | 26 ------------------- .../fixture/variables.tf | 23 ---------------- .../hub_and_spoke_peering/test_plan.py | 20 -------------- .../networking/hub_and_spoke_vpn/__init__.py | 13 ---------- .../hub_and_spoke_vpn/fixture/main.tf | 25 ------------------ .../hub_and_spoke_vpn/fixture/variables.tf | 23 ---------------- .../networking/hub_and_spoke_vpn/test_plan.py | 20 -------------- 10 files changed, 32 insertions(+), 163 deletions(-) delete mode 100644 tests/blueprints/networking/hub_and_spoke_peering/__init__.py delete mode 100644 tests/blueprints/networking/hub_and_spoke_peering/fixture/main.tf delete mode 100644 tests/blueprints/networking/hub_and_spoke_peering/fixture/variables.tf delete mode 100644 tests/blueprints/networking/hub_and_spoke_peering/test_plan.py delete mode 100644 tests/blueprints/networking/hub_and_spoke_vpn/__init__.py delete mode 100644 tests/blueprints/networking/hub_and_spoke_vpn/fixture/main.tf delete mode 100644 tests/blueprints/networking/hub_and_spoke_vpn/fixture/variables.tf delete mode 100644 tests/blueprints/networking/hub_and_spoke_vpn/test_plan.py diff --git a/blueprints/networking/hub-and-spoke-peering/README.md b/blueprints/networking/hub-and-spoke-peering/README.md index d39cb3aa..e9a05cf2 100644 --- a/blueprints/networking/hub-and-spoke-peering/README.md +++ b/blueprints/networking/hub-and-spoke-peering/README.md @@ -100,3 +100,20 @@ The VPN used to connect the GKE masters VPC does not account for HA, upgrading t | [vms](outputs.tf#L20) | GCE VMs. | | + +## Test + +```hcl +module "test" { + source = "./fabric/blueprints/networking/hub-and-spoke-peering" + prefix = "prefix" + project_create = { + billing_account = "123456-123456-123456" + oslogin = true + parent = "folders/123456789" + } + project_id = "project-1" +} + +# tftest modules=22 resources=61 +``` diff --git a/blueprints/networking/hub-and-spoke-vpn/README.md b/blueprints/networking/hub-and-spoke-vpn/README.md index bdf877c7..9cfca228 100644 --- a/blueprints/networking/hub-and-spoke-vpn/README.md +++ b/blueprints/networking/hub-and-spoke-vpn/README.md @@ -101,3 +101,18 @@ ping test-r2.dev.example.com | [vms](outputs.tf#L39) | GCE VMs. | | + +## Test +```hcl +module "test" { + source = "./fabric/blueprints/networking/hub-and-spoke-vpn" + prefix = "prefix" + project_create_config = { + billing_account_id = "123456-123456-123456" + parent_id = "folders/123456789" + } + project_id = "project-1" +} + +# tftest modules=20 resources=73 +``` diff --git a/tests/blueprints/networking/hub_and_spoke_peering/__init__.py b/tests/blueprints/networking/hub_and_spoke_peering/__init__.py deleted file mode 100644 index 6d6d1266..00000000 --- a/tests/blueprints/networking/hub_and_spoke_peering/__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/blueprints/networking/hub_and_spoke_peering/fixture/main.tf b/tests/blueprints/networking/hub_and_spoke_peering/fixture/main.tf deleted file mode 100644 index c5b105e6..00000000 --- a/tests/blueprints/networking/hub_and_spoke_peering/fixture/main.tf +++ /dev/null @@ -1,26 +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 = "../../../../../blueprints/networking/hub-and-spoke-peering" - prefix = var.prefix - project_create = { - billing_account = "123456-123456-123456" - oslogin = true - parent = "folders/123456789" - } - project_id = var.project_id -} diff --git a/tests/blueprints/networking/hub_and_spoke_peering/fixture/variables.tf b/tests/blueprints/networking/hub_and_spoke_peering/fixture/variables.tf deleted file mode 100644 index b67795f9..00000000 --- a/tests/blueprints/networking/hub_and_spoke_peering/fixture/variables.tf +++ /dev/null @@ -1,23 +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 -# -# https://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 "prefix" { - type = string - default = "test" -} - -variable "project_id" { - type = string - default = "project-1" -} diff --git a/tests/blueprints/networking/hub_and_spoke_peering/test_plan.py b/tests/blueprints/networking/hub_and_spoke_peering/test_plan.py deleted file mode 100644 index 127a0ba4..00000000 --- a/tests/blueprints/networking/hub_and_spoke_peering/test_plan.py +++ /dev/null @@ -1,20 +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. - - -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) == 21 - assert len(resources) == 61 diff --git a/tests/blueprints/networking/hub_and_spoke_vpn/__init__.py b/tests/blueprints/networking/hub_and_spoke_vpn/__init__.py deleted file mode 100644 index 6d6d1266..00000000 --- a/tests/blueprints/networking/hub_and_spoke_vpn/__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/blueprints/networking/hub_and_spoke_vpn/fixture/main.tf b/tests/blueprints/networking/hub_and_spoke_vpn/fixture/main.tf deleted file mode 100644 index 37558c71..00000000 --- a/tests/blueprints/networking/hub_and_spoke_vpn/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 = "../../../../../blueprints/networking/hub-and-spoke-vpn" - prefix = var.prefix - project_create_config = { - billing_account_id = "ABCDE-123456-ABCDE" - parent_id = null - } - project_id = var.project_id -} diff --git a/tests/blueprints/networking/hub_and_spoke_vpn/fixture/variables.tf b/tests/blueprints/networking/hub_and_spoke_vpn/fixture/variables.tf deleted file mode 100644 index b67795f9..00000000 --- a/tests/blueprints/networking/hub_and_spoke_vpn/fixture/variables.tf +++ /dev/null @@ -1,23 +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 -# -# https://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 "prefix" { - type = string - default = "test" -} - -variable "project_id" { - type = string - default = "project-1" -} diff --git a/tests/blueprints/networking/hub_and_spoke_vpn/test_plan.py b/tests/blueprints/networking/hub_and_spoke_vpn/test_plan.py deleted file mode 100644 index a24aaa59..00000000 --- a/tests/blueprints/networking/hub_and_spoke_vpn/test_plan.py +++ /dev/null @@ -1,20 +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. - - -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) == 19 - assert len(resources) == 73