Skip to content

Commit 1772b51

Browse files
committed
On branch edburns/resolve-fake-test-time-token-failures
modified: src/test/java/com/github/copilot/sdk/E2ETestContext.java modified: src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java Given that the live API was never used, I see no reason why we should condition the setting of fake tokens on the runtime environment (CI vs local). The replaying proxy intercepts everything regardless of environment. The fake token just satisfies the CLI's startup check — it's never sent to a real API. The `GITHUB_ACTIONS` guard is unnecessary and is what broke local runs.
1 parent 6c9fdba commit 1772b51

2 files changed

Lines changed: 6 additions & 24 deletions

File tree

src/test/java/com/github/copilot/sdk/E2ETestContext.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,10 @@ public Map<String, String> getEnvironment() {
270270
env.put("REQUESTS_CA_BUNDLE", caFile);
271271
env.put("CURL_CA_BUNDLE", caFile);
272272
env.put("GIT_SSL_CAINFO", caFile);
273-
env.put("GH_TOKEN", "");
274-
env.put("GITHUB_TOKEN", "");
275-
env.put("GH_ENTERPRISE_TOKEN", "");
276-
env.put("GITHUB_ENTERPRISE_TOKEN", "");
277-
}
278-
279-
if ("true".equals(System.getenv("GITHUB_ACTIONS"))) {
280273
env.put("GH_TOKEN", "fake-token-for-e2e-tests");
281274
env.put("GITHUB_TOKEN", "fake-token-for-e2e-tests");
275+
env.put("GH_ENTERPRISE_TOKEN", "");
276+
env.put("GITHUB_ENTERPRISE_TOKEN", "");
282277
}
283278

284279
return env;
@@ -291,13 +286,7 @@ public Map<String, String> getEnvironment() {
291286
*/
292287
public CopilotClient createClient() {
293288
CopilotClientOptions options = new CopilotClientOptions().setCliPath(cliPath).setCwd(workDir.toString())
294-
.setEnvironment(getEnvironment());
295-
296-
// In CI (GitHub Actions), use a fake token to avoid auth issues
297-
String ci = System.getenv("GITHUB_ACTIONS");
298-
if (ci != null && !ci.isEmpty()) {
299-
options.setGitHubToken("fake-token-for-e2e-tests");
300-
}
289+
.setEnvironment(getEnvironment()).setGitHubToken("fake-token-for-e2e-tests");
301290

302291
return new CopilotClient(options);
303292
}
@@ -321,10 +310,7 @@ public CopilotClient createClient(CopilotClientOptions options) {
321310
if (options.getEnvironment() == null || options.getEnvironment().isEmpty()) {
322311
options.setEnvironment(getEnvironment());
323312
}
324-
325-
// In CI (GitHub Actions), use a fake token to avoid auth issues
326-
String ci = System.getenv("GITHUB_ACTIONS");
327-
if (ci != null && !ci.isEmpty() && options.getGitHubToken() == null) {
313+
if (options.getGitHubToken() == null) {
328314
options.setGitHubToken("fake-token-for-e2e-tests");
329315
}
330316

src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,8 @@ int getTaskCount() {
8787

8888
private CopilotClientOptions createOptionsWithExecutor(TrackingExecutor executor) {
8989
CopilotClientOptions options = new CopilotClientOptions().setCliPath(ctx.getCliPath())
90-
.setCwd(ctx.getWorkDir().toString()).setEnvironment(ctx.getEnvironment()).setExecutor(executor);
91-
92-
String ci = System.getenv("GITHUB_ACTIONS");
93-
if (ci != null && !ci.isEmpty()) {
94-
options.setGitHubToken("fake-token-for-e2e-tests");
95-
}
90+
.setCwd(ctx.getWorkDir().toString()).setEnvironment(ctx.getEnvironment()).setExecutor(executor)
91+
.setGitHubToken("fake-token-for-e2e-tests");
9692
return options;
9793
}
9894

0 commit comments

Comments
 (0)