From c36bf77d3eb1025099602a4d339975d09084746f Mon Sep 17 00:00:00 2001 From: amreshh <20923769+amreshh@users.noreply.github.com> Date: Thu, 5 Mar 2026 20:54:11 +0100 Subject: [PATCH] fix: use getBaseURL in acc_test.go to match provider URL parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit acc_test.go was parsing GITHUB_BASE_URL with url.Parse() directly, bypassing the normalization done by getBaseURL() in the provider. This caused the test base URL to differ from what the provider produces (e.g. missing trailing slash, no github.com → api.github.com rewrite, no ghe.com API host prefix). Additionally, IsGHES was never set on the test Config, so GHES-specific behavior was not exercised in tests. --- github/acc_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/github/acc_test.go b/github/acc_test.go index f72d454ee7..523d9e508b 100644 --- a/github/acc_test.go +++ b/github/acc_test.go @@ -35,6 +35,7 @@ var ( type testAccConfig struct { // Target configuration baseURL *url.URL + isGHES bool // Auth configuration authMode testMode @@ -100,12 +101,7 @@ func TestMain(m *testing.M) { authMode = anonymous } - u, ok := os.LookupEnv("GITHUB_BASE_URL") - if !ok { - u = DotComAPIURL - } - - baseURL, err := url.Parse(u) + baseURL, isGHES, err := getBaseURL(os.Getenv("GITHUB_BASE_URL")) if err != nil { fmt.Printf("Error parsing base URL: %s\n", err) os.Exit(1) @@ -113,6 +109,7 @@ func TestMain(m *testing.M) { config := testAccConfig{ baseURL: baseURL, + isGHES: isGHES, authMode: authMode, testPublicRepository: "terraform-provider-github", testPublicRepositoryOwner: "integrations", @@ -194,6 +191,7 @@ func getTestMeta() (*Owner, error) { Token: testAccConf.token, Owner: testAccConf.owner, BaseURL: testAccConf.baseURL, + IsGHES: testAccConf.isGHES, } meta, err := config.Meta()