Repository navigation
Closed
Description
Expected Behavior
Running the unit test make testacc T=TestAccGithubTeamMembership for github enterprise server should be successful.
Actual Behavior
make testacc T=TestAccGithubTeamMembership fails because it the api request is being sent to the web frontend instead of the api, which results in a redirect to the login page and a http/406 error.
The endpoint of our enterprise server is https://hostname/api/v3
(github hostname and username has been redacted), but from the test result we can see the wrong uri is being called.
❯ make testacc T=TestAccGithubTeamMembership
==> Running acceptance tests on branch: 🌿 bug/base-url-ghes 🌿...
TF_ACC=1 CGO_ENABLED=0 go test ./github/... -v -run '^TestAcc' -run='TestAccGithubTeamMembership' -timeout 120m -count=1
=== RUN TestAccGithubTeamMembership
=== RUN TestAccGithubTeamMembership/creates_a_team_membership
resource_github_team_membership_test.go:26: Step 1/2 error: Check failed: Check 1/4 error: GET https://_hostname_/login?return_to=https%3A%2F%2F_hostname_%2Forganizations%2F0%2Fteam%2F37%2Fmemberships%2F_username_: 406 []
panic.go:694: Error running post-test destroy, there may be dangling resources: GET https://_hostname_/login?return_to=https%3A%2F%2F_hostname_%2Forganizations%2F0%2Fteam%2F37%2Fmemberships%2F_username_: 406 []
=== RUN TestAccGithubTeamMembership/is_case_insensitive
resource_github_team_membership_test.go:64: Step 1/2 error: Check failed: Check 1/1 error: GET https://_hostname_/login?return_to=https%3A%2F%2F_hostname_%2Forganizations%2F0%2Fteam%2F39%2Fmemberships%2F_username_: 406 []
panic.go:694: Error running post-test destroy, there may be dangling resources: GET https://_hostname_/login?return_to=https%3A%2F%2F_hostname_%2Forganizations%2F0%2Fteam%2F39%2Fmemberships%2F_username_: 406 []
--- FAIL: TestAccGithubTeamMembership (23.31s)
--- FAIL: TestAccGithubTeamMembership/creates_a_team_membership (11.85s)
--- FAIL: TestAccGithubTeamMembership/is_case_insensitive (11.46s)
FAIL
FAIL github.com/integrations/terraform-provider-github/v6/github 23.315s
FAIL
make: *** [GNUmakefile:62: testacc] Error 1Terraform Version
N.A.
Affected Resource(s)
Testcases which call getTestMeta()
Terraform Configuration Files
Steps to Reproduce
Running below testcase against a GHES environment.
make testacc T=TestAccGithubTeamMembership
Debug Output
Panic Output
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
github-actions commentedon Mar 5, 2026
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with
Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀deiga commentedon Mar 5, 2026
Hey @amreshh
Could you share the ENV variables you used to configure the test run?
amreshh commentedon Mar 5, 2026
Hey @deiga : these are the env var's I set
amreshh commentedon Mar 5, 2026
I also tried setting GITHUB_BASE_URL to the api endpoint like so
GITHUB_BASE_URL=https://<<my-github-enterprise-instance>>/api/v3/Then the test complains about the baseURL not having a trailing slash, eventhough I am setting it
amreshh commentedon Mar 5, 2026
In provider.go, the
baseURLusesgetBaseURL()which parses the endpoint and also sets whether or not this is a GitHub Enterprise Server.But acc_test.go uses whatever is being set as the
GITHUB_BASE_URLvar, so we don't get thegetBaseURL()parsing.deiga commentedon Mar 5, 2026
Thanks for highlighting this!
We don't currently have a GHES instance to test against, so this has fallen through the cracks.
Would you be available to provide a PR to fix it?
amreshh commentedon Mar 5, 2026
Yes I was already working on a fix 😀