terraform-provider-github
terraform-provider-github copied to clipboard
[MAINT]: Document (and automate?) required resources to run integration tests
Describe the need
Currently, our unit tests expect a variety of prerequisites to avoid skipping and run successfully. These include:
- An organization and a user account
- A template repository inside the organization
- A GitHub App installed at the organization level
- The GitHub App installed on at least one repo and the installation ID exported to a particular environment variable
The above list is non-exhaustive. When this issue is closed, we should at a minimum have documented all the criteria required to run unit tests. We should also have evaluated whether it's worth automating the creation of the prerequisites.
SDK Version
all versions
API Version
N/A
Relevant log output
N/A
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
I'll do my best to work on untangling this over the next couple of weeks unless someone is actively working on it. My plan is to create a TESTING.md file which can be linked to in CONTRIBUTING.md. Long term that document can possibly include testing procedures, standards, and things of that nature.
<3 <3 <3 that would be wonderful @wwsean08! Your plan sounds excellent.
Quick question, is there any way to determine if an account is an enterprise account? TestAccGithubOrganizationIpAllowListDataSource/queries_without_error/with_an_organization_account this test manages an IP allow list which is limited to enterprise accounts? If it is possible it might be worth adding special "enterprise" type tests.
is there any way to determine if an account is an enterprise account?
I'm not aware of anything, unfortunately. Perhaps it would be possible to figure this out through the Get the authenticated user endpoint, or the Return all of the user's organization memberships workflow.
If it is possible it might be worth adding special "enterprise" type tests.
I agree; I think this would be super worthwhile!
Turns out there actually is an enterprise constant and I just missed it, so I'll look at fixing the tests that are enterprise dependent. I wasn't using my terminology correctly as I meant an org is enterprise, but it seems like we've got this resolved at this point.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
I've refactored the tests in #2476 to address #2425, hopefully they're easier to understand now and consistent.