This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
feat(tests): Fetch only the resources required for test being run #400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This closes #398
When adding a new resource, it is desirable to only fetch that resource during integration testing. Before this change, all resources were fetched (which took about 3.5 minutes). After the change, only the resources required by the subtest are fetched (so test runs for cq-provider-aws now take about 10 seconds on my machine, when limiting to a specific table).
For example, when running integration tests with:
only the resources required to populate the
aws_lightsail_instances
and related tables will be fetched. If a subtest is not being run, all resources will still be fetched. This means integration tests for a specific resource can be run in about 10 seconds, as opposed to the several minutes it took before. The trade-off is, however, that the full suite will take slightly longer to run. I think this is worthwhile trade-off to make, as long as we're not also jeopardizing correctness. I think this could happen if there are dependencies between resources, but hopefully the tests for this PR will fail now if this is the case.Use the following steps to ensure your PR is ready to be reviewed
go fmt
to format your code 🖊golangci-lint run
🚨 (install golangci-lint here)