Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add end-to-end tests for project module #1823

Merged
merged 9 commits into from
Nov 3, 2023
Merged

Conversation

wiktorn
Copy link
Collaborator

@wiktorn wiktorn commented Oct 28, 2023

modules/project examples

Modifying almost all examples in project module allowing to be run as end-to-end tests. The only one left is the one requiring org.

Interesting finding - module fails if no billing account is attached, unless you provide auto_create_network = true. This is probably due to the fact, that provider removes the default network after project is created and this requires compute API, and this is only allowed if billing is attached.

Error: Error enabling the Compute Engine API required to delete the default network: failed to enable services: failed on request preconditions: googleapi: Error 400: Billing account for project '***' is not found. Billing must be enabled for activation of service(s) 'compute.googleapis.com,compute.googleapis.com,compute.googleapis.com' to proceed

I decided to add billing account to all examples

Added one big example using project_create = false to test (hopefully) all cases with data resource in use.

Bug fixes for modules/project

  • log sink creation failed as it didn't wait to activate logging service

E2E framework updates

Modifying E2E test framework to provide unique prefix on each test run. This is very useful here, and will be useful in any other areas where global uniqueness is required.

This results in dependency on providing TF_VAR_prefix variable hence making the *.tfvars approach even less comfortable and I lean towards removing it. The problem is, that now the TF_VAR_prefix is needed both in Terraform code and in Python code.

Added new required resources to test harness:

  • KMS key id
  • group_email

Added support for files= clause in # tftest line to end-to-end tests, to make sure that we are testing the same thing whether running standard testes/examples and test/examples_e2e

Sample E2E tests run


Checklist

I applicable, I acknowledge that I have:

  • Read the contributing guide
  • Ran terraform fmt on all modified files
  • Regenerated the relevant README.md files using tools/tfdoc.py
  • Made sure all relevant tests pass

@wiktorn wiktorn requested a review from juliocc October 28, 2023 21:43
@wiktorn wiktorn force-pushed the wiktorn-project-examples branch from 82acd82 to 61e732f Compare October 28, 2023 21:47
@wiktorn wiktorn force-pushed the wiktorn-project-examples branch 2 times, most recently from 9ef29bc to c7cd45f Compare October 29, 2023 08:24
@wiktorn wiktorn force-pushed the wiktorn-project-examples branch from c7cd45f to 972e0ab Compare October 29, 2023 08:54
@wiktorn wiktorn requested a review from ludoo October 31, 2023 10:47
@wiktorn wiktorn force-pushed the wiktorn-project-examples branch from f03ea77 to 4e5a15e Compare October 31, 2023 11:57
@wiktorn wiktorn force-pushed the wiktorn-project-examples branch from 4e5a15e to dda62bc Compare October 31, 2023 12:00
@ludoo
Copy link
Collaborator

ludoo commented Nov 2, 2023

Will take me a while to go through this, plz be patient. :)

Copy link
Collaborator

@ludoo ludoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice, thanks Wiktor

tests/examples/test_plan.py Outdated Show resolved Hide resolved
@wiktorn wiktorn merged commit fe48541 into master Nov 3, 2023
9 checks passed
@wiktorn wiktorn deleted the wiktorn-project-examples branch November 3, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants