Skip to content

[BUG]: TestAccGithubMembership fails on GHES #3256

@amreshh

Description

@amreshh

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 1

Terraform 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions