Skip to content

Commit b6c3795

Browse files
committed
Add test to verify that GITHUB_TOKEN and app_auth are not set at the same time
Signed-off-by: Timo Sand <[email protected]>
1 parent 73fd9d7 commit b6c3795

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

github/provider_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,29 @@ func TestAccProviderConfigure(t *testing.T) {
241241
},
242242
})
243243
})
244+
t.Run("should not allow app_auth and GITHUB_TOKEN to be configured", func(t *testing.T) {
245+
config := fmt.Sprintf(`
246+
provider "github" {
247+
owner = "%s"
248+
app_auth {
249+
id = "1234567890"
250+
installation_id = "1234567890"
251+
pem_file = "1234567890"
252+
}
253+
}
254+
255+
data "github_ip_ranges" "test" {}
256+
`, testAccConf.owner)
257+
258+
resource.Test(t, resource.TestCase{
259+
PreCheck: func() { skipUnauthenticated(t); t.Setenv("GITHUB_TOKEN", "1234567890") },
260+
ProviderFactories: providerFactories,
261+
Steps: []resource.TestStep{
262+
{
263+
Config: config,
264+
ExpectError: regexp.MustCompile("\"app_auth\": conflicts with token"),
265+
},
266+
},
267+
})
268+
})
244269
}

0 commit comments

Comments
 (0)