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

feat: add validations func & create acceptance tests #32

Draft
wants to merge 3 commits into
base: feat/INT-4355/schema
Choose a base branch
from

Conversation

lriberon
Copy link
Contributor

@lriberon lriberon commented Jan 8, 2025

Description

This PR provide Acceptance Tests and enhance the schema's validations when performing a terraform plan.

Here is the list of Acceptance Tests:

  • Simple case -> create a new endpoint with the provided example at examples/main.tf
  • Without Optional fields -> create a new endpoint by providing only the required fields
  • With position before -> create a first endpoint and a second one by using the ID of the first endpoint for the position_before field
  • With a regular expression -> create a new endpoint by providing a regular expression for the user_agent_inclusion
  • Wrong cases -> we test all the possible conditions that can raise an error during the terraform plan
    • Missing required argument
    • Wrong response_format value
    • Wrong source value
    • Wrong traffic_usage value (regardless the source value)
    • Wrong traffic_usage value with Api for the source value
    • Wrong traffic_usage value with Mobile App for the source value
    • Wrong cookie_same_site value
    • Wrong position_before format (i.e. not an UUID)
    • Wrong regular expression value

How to test?

Run Acceptance tests

Run the make testacc command to run all the Acceptance Tests.

Manually

  1. Go to the examples/ directory
  2. Initialize the Terraform state: terraform init
  3. Specify the information you want on your endpoint resource in your main.tf file (you can update the existing example if needed)
  4. Check the information to be inserted: terraform plan
  5. An error should be raised if there is a wrong input.
  6. If no error has been raised, you can apply your changes: terraform apply. You should see the output: Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
  7. Check on the dashboard that the information are the same

@lriberon
Copy link
Contributor Author

lriberon commented Jan 8, 2025

This PR can be reviewed once #31 has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants