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(acc_test): Adds acceptance testing primitives and test cases #158

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

jaspalo
Copy link
Contributor

@jaspalo jaspalo commented Sep 10, 2024

Description

Adds acceptance testing primitives for Terraform Panos Provider resources and data sources

Motivation and Context

To be sure of the behaviour and predictability of the resources, data sources and other elements enabled by the Panos Terraform provider, we need to verify them through acceptance testing.

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

The changes add primitives and patterns of acceptance testing framework by terraform. Tests covers the following resources:

  • template
  • address_objects
  • ethernet_interface
  • address_group
  • virtual_router

Checklist

  • I've added terraform testing framework to the project
  • I've written basic tests for the resources mentioned above
  • I'll fix the checks in address_objects tests by updating state path traversal.
  • Custom testing primitives needs to be improved to be consistent across different testing patterns

@jaspalo jaspalo marked this pull request as draft September 10, 2024 09:33
@jaspalo jaspalo force-pushed the feat/accpt-testing-configs branch 2 times, most recently from 8215e7f to d98f8ed Compare September 12, 2024 11:30
@jaspalo jaspalo marked this pull request as ready for review September 12, 2024 11:35
@jaspalo jaspalo changed the title feat(acc_test): WIP: Adds acceptance testing primitives feat(acc_test): Adds acceptance testing primitives and test cases Sep 12, 2024
README.md Outdated
# if we have self-signed certificate for a testing instance
export PANOS_SKIP_VERIFY_CERTIFICATE=true

# We use either API key or username, password pair for authentication
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like use of usernames and passwords has an undesired effect of causing tests to fail when executed in parallel? Should we even document that both can be used in that case? Perhaps we need a check in the check function to verify that credentials are not used when parallel > 1 ?

nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
compareValuesDiffer := statecheck.CompareValue(compare.ValuesDiffer())

resource.Test(t, resource.TestCase{
Copy link
Contributor

Choose a reason for hiding this comment

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

All tests seem to be missing CheckDestroy used to verify that resources have actually been removed from the server.

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProviders,
Steps: []resource.TestStep{
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets either uncomment this code and fix it, or just drop it from the PR

Adds pango client to the test suite and implements check destroys
@jaspalo jaspalo merged commit 73cfe3f into main Sep 19, 2024
3 checks passed
@jaspalo jaspalo deleted the feat/accpt-testing-configs branch September 19, 2024 09:46
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