diff --git a/blueprints/serverless/api-gateway/README.md b/blueprints/serverless/api-gateway/README.md index 9e17b11e..42e6f175 100644 --- a/blueprints/serverless/api-gateway/README.md +++ b/blueprints/serverless/api-gateway/README.md @@ -22,6 +22,23 @@ Clone this repository or [open it in cloud shell](https://ssh.cloud.google.com/c curl -v http:///hello Once done testing, you can clean up resources by running `terraform destroy`. + + + ## Variables diff --git a/tests/blueprints/serverless/__init__.py b/tests/blueprints/serverless/__init__.py deleted file mode 100644 index 6d6d1266..00000000 --- a/tests/blueprints/serverless/__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/serverless/api_gateway/__init__.py b/tests/blueprints/serverless/api_gateway/__init__.py deleted file mode 100644 index 6d6d1266..00000000 --- a/tests/blueprints/serverless/api_gateway/__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/serverless/api_gateway/fixture/main.tf b/tests/blueprints/serverless/api_gateway/fixture/main.tf deleted file mode 100644 index 094d4697..00000000 --- a/tests/blueprints/serverless/api_gateway/fixture/main.tf +++ /dev/null @@ -1,22 +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/serverless/api-gateway" - project_create = var.project_create - project_id = var.project_id - regions = var.regions -} diff --git a/tests/blueprints/serverless/api_gateway/fixture/variables.tf b/tests/blueprints/serverless/api_gateway/fixture/variables.tf deleted file mode 100644 index dce1579c..00000000 --- a/tests/blueprints/serverless/api_gateway/fixture/variables.tf +++ /dev/null @@ -1,39 +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 "project_create" { - type = object({ - billing_account_id = string - parent = string - }) - default = { - billing_account_id = "123456789" - parent = "organizations/123456789" - } -} - -variable "project_id" { - type = string - default = "project-1" -} - -variable "regions" { - type = list(string) - default = [ - "europe-west1", - "europe-west2" - ] -} diff --git a/tests/blueprints/serverless/api_gateway/test_plan.py b/tests/blueprints/serverless/api_gateway/test_plan.py deleted file mode 100644 index 9d658398..00000000 --- a/tests/blueprints/serverless/api_gateway/test_plan.py +++ /dev/null @@ -1,19 +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) == 7 - assert len(resources) == 32 diff --git a/tests/examples/conftest.py b/tests/examples/conftest.py index 4d3d85ee..bc0d3bff 100644 --- a/tests/examples/conftest.py +++ b/tests/examples/conftest.py @@ -68,6 +68,22 @@ def pytest_generate_tests(metafunc): name += f' {index}' ids.append(name) examples.append(Example(name, code, path, files[last_header])) + if isinstance(child, marko.block.HTMLBlock): + # parse tftest blocks from HTML blocks comment (user by + # blueprints to test without having to create wrapper + # modules) + code = child.children + if code.startswith('\n') + if index > 1: + name += f' {index}' + ids.append(name) + # TODO: examples in HTML comment blocks can't use + # tftest-file + examples.append(Example(name, code, path, {})) elif isinstance(child, marko.block.Heading): last_header = child.children[0].children index = 0