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

Internal RFC: Acceptance test generation #38

Closed
ewbankkit opened this issue Jul 14, 2021 · 2 comments
Closed

Internal RFC: Acceptance test generation #38

ewbankkit opened this issue Jul 14, 2021 · 2 comments
Assignees
Labels
Milestone

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Jul 14, 2021

Description

In theory we can generate acceptance tests based on the CloudAPI schema definition in order to fully validate the behavior of the generated provider and protect against both local and upstream regression.

The terraform-plugin-framework does not currently provide testing support, however as the existing SDK relies on binary testing it should be possible to use the terraform-plugin-sdk to enable these tests to be run.

However, given the generated nature of the provider, and that the generation code is really the subject under test we may choose to rely mainly on unit tests. The detailed per-attribute, full lifecycle tests that we do for the existing provider, may not be appropriate given the vast range of services on offer from AWS and that the provider code is meant to be generic across services.

Definition of Done

  • We understand whether the terraform-plugin-sdk will allow us to test this provider.
    That we have in Internal RFC (with team alignment) which specifies:
  • Our testing strategy for the generated provider
  • If we choose to pursue generated acceptance tests, an agreed scope for 0.1, 0.2 and 1.0 release.
@breathingdust breathingdust changed the title Acceptance testing Internal RFC: Acceptance test generation Jul 23, 2021
@breathingdust breathingdust added this to the v0.1.0 milestone Jul 28, 2021
@ewbankkit
Copy link
Contributor Author

ewbankkit commented Jul 28, 2021

Following the merge of #79. We should now be able to generate a _basic and _disappears test for every resource type that has No required attributes.
Detecting this should be possible during Terraform schema code generation.

For those resource types that have required attributes the generated _basic tests is:

func TestAccAWSAppMeshVirtualService_basic(t *testing.T) {
	data := acctest.NewTestData(t, "AWS::AppMesh::VirtualService", "aws_appmesh_virtual_service", "test")
	r := virtualServiceTest{}

	data.ResourceTest(t, []resource.TestStep{
		{
			Config: r.basic(data),

			ExpectError: regexp.MustCompile(`Missing required argument`),
		},
	})
}

@breathingdust
Copy link
Member

Internal RFC and review complete.

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

No branches or pull requests

3 participants