Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/internal/core/providers/vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,29 +139,29 @@ func TestGitHubEnterpriseUsesTheEnterpriseToken(t *testing.T) {

t.Run("github.com uses GH_TOKEN", func(t *testing.T) {
calls := fakeCLI(t, "gh", `[]`)
t.Setenv("GH_TOKEN", "dotcom-token")
t.Setenv("GH_TOKEN", "test-secret-not-real-dotcom")
GitHub{}.Deploy(vcsTarget(t, pub))

log := callLog(t, calls)
if !strings.Contains(log, "GH_HOST=github.com") {
t.Errorf("GH_HOST not set:\n%s", log)
}
if !strings.Contains(log, "GH_TOKEN=dotcom-token") || strings.Contains(log, "GH_ENTERPRISE_TOKEN=dotcom-token") {
if !strings.Contains(log, "GH_TOKEN=test-secret-not-real-dotcom") || strings.Contains(log, "GH_ENTERPRISE_TOKEN=test-secret-not-real-dotcom") {
t.Errorf("github.com should authenticate with GH_TOKEN:\n%s", log)
}
})

t.Run("a GHES host uses GH_ENTERPRISE_TOKEN", func(t *testing.T) {
calls := fakeCLI(t, "gh", `[]`)
t.Setenv("GHES_TOKEN", "ghes-token")
t.Setenv("GHES_TOKEN", "test-secret-not-real-ghes")
gh := GitHub{spec: Spec{Host: "github.example.com", TokenEnv: "GHES_TOKEN"}}
gh.Deploy(vcsTarget(t, pub))

log := callLog(t, calls)
if !strings.Contains(log, "GH_HOST=github.example.com") {
t.Errorf("GH_HOST should carry the enterprise host:\n%s", log)
}
if !strings.Contains(log, "GH_ENTERPRISE_TOKEN=ghes-token") {
if !strings.Contains(log, "GH_ENTERPRISE_TOKEN=test-secret-not-real-ghes") {
t.Errorf("a GHES host authenticates with GH_ENTERPRISE_TOKEN:\n%s", log)
}
})
Expand Down
Loading