terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[MAINT]: Document (and automate?) required resources to run integration tests

Open kfcampbell opened this issue 3 years ago • 6 comments

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

kfcampbell avatar Dec 06 '22 22:12 kfcampbell

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.

wwsean08 avatar Jan 04 '23 06:01 wwsean08

<3 <3 <3 that would be wonderful @wwsean08! Your plan sounds excellent.

kfcampbell avatar Jan 04 '23 17:01 kfcampbell

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.

wwsean08 avatar Jan 14 '23 23:01 wwsean08

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!

kfcampbell avatar Jan 17 '23 20:01 kfcampbell

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.

wwsean08 avatar Jan 18 '23 05:01 wwsean08

👋 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!

github-actions[bot] avatar Apr 20 '24 01:04 github-actions[bot]

I've refactored the tests in #2476 to address #2425, hopefully they're easier to understand now and consistent.

stevehipwell avatar Nov 26 '24 22:11 stevehipwell