Skip to content

Commit fe5e3e5

Browse files
Make use of fake GitHub token consistent
1 parent 812ffd2 commit fe5e3e5

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

dotnet/test/Harness/E2ETestContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public IReadOnlyDictionary<string, string> GetEnvironment()
9696
{
9797
CliPath = CliPath,
9898
Cwd = WorkDir,
99-
Environment = GetEnvironment()
99+
Environment = GetEnvironment(),
100+
GithubToken = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) ? "fake-token-for-e2e-tests" : null,
100101
});
101102

102103
public async ValueTask DisposeAsync()

go/e2e/testharness/context.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,18 @@ func (c *TestContext) Env() []string {
159159

160160
// NewClient creates a CopilotClient configured for this test context.
161161
func (c *TestContext) NewClient() *copilot.Client {
162-
return copilot.NewClient(&copilot.ClientOptions{
162+
options := &copilot.ClientOptions{
163163
CLIPath: c.CLIPath,
164164
Cwd: c.WorkDir,
165165
Env: c.Env(),
166-
})
166+
}
167+
168+
// Use fake token in CI to allow cached responses without real auth
169+
if os.Getenv("CI") == "true" {
170+
options.GithubToken = "fake-token-for-e2e-tests"
171+
}
172+
173+
return copilot.NewClient(options)
167174
}
168175

169176
func fileExists(path string) bool {

0 commit comments

Comments
 (0)