Skip to content

Commit de6ba31

Browse files
authored
Merge pull request #3950 from continuedev/nate/ignore-api-key-tests
skip llm tests on forks
2 parents dec8940 + 2111874 commit de6ba31

File tree

7 files changed

+36
-19
lines changed

7 files changed

+36
-19
lines changed

.github/workflows/pr_checks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ jobs:
285285
cd core
286286
npm test
287287
env:
288+
IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }}
288289
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
289290
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
290291
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
@@ -443,6 +444,7 @@ jobs:
443444
chmod 600 ~/.ssh/id_rsa
444445
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
445446
echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
447+
if: ${{ github.event.pull_request.head.repo.fork == false }}
446448

447449
- name: Set up Xvfb
448450
run: |
@@ -452,7 +454,7 @@ jobs:
452454
- name: Run e2e tests
453455
run: |
454456
cd extensions/vscode
455-
TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
457+
IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
456458
env:
457459
DISPLAY: :99
458460

core/autocomplete/CompletionProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export class CompletionProvider {
246246
completionOptions,
247247
cacheHit,
248248
filepath: helper.filepath,
249+
numLines: completion.split("\n").length,
249250
completionId: helper.input.completionId,
250251
gitRepo: await this.ide.getRepoName(helper.filepath),
251252
uniqueId: await this.ide.getUniqueId(),

core/autocomplete/util/types.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
Position,
3-
Range,
4-
RangeInFile,
5-
RangeInFileWithContents,
6-
TabAutocompleteOptions,
7-
} from "../..";
1+
import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../..";
82
import { AutocompleteCodeSnippet } from "../snippets/types";
93

104
export type RecentlyEditedRange = RangeInFile & {
@@ -42,6 +36,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions {
4236
modelName: string;
4337
completionOptions: any;
4438
cacheHit: boolean;
39+
numLines: number;
4540
filepath: string;
4641
gitRepo?: string;
4742
completionId: string;

core/indexing/docs/crawlers/DefaultCrawler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class DefaultCrawler {
2626
});
2727
if (!resp.ok) {
2828
const text = await resp.text();
29-
throw new Error(`Failed to crawl site: ${text}`);
29+
throw new Error(`Failed to crawl site (${resp.status}): ${text}`);
3030
}
3131
const json = (await resp.json()) as PageData[];
3232
return json;

core/indexing/docs/crawlers/DocsCrawler.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,15 @@ describe("DocsCrawler", () => {
152152
);
153153

154154
commonDocsSites.forEach((url) => {
155-
test(`Default crawler common site: ${url}`, async () => {
156-
const { pages, crawler } = await runCrawl(url);
157-
expect(pages.length).toBeGreaterThanOrEqual(1);
158-
expect(crawler).toEqual("default");
159-
});
155+
test(
156+
`Default crawler common site: ${url}`,
157+
async () => {
158+
const { pages, crawler } = await runCrawl(url);
159+
expect(pages.length).toBeGreaterThanOrEqual(1);
160+
expect(crawler).toEqual("default");
161+
},
162+
TIMEOUT_MS,
163+
);
160164
});
161165
});
162166

core/llm/llm.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ function testLLM(
178178
}
179179

180180
describe("LLM", () => {
181+
if (process.env.IGNORE_API_KEY_TESTS === "true") {
182+
test("Skipping API key tests", () => {
183+
console.log(
184+
"Skipping API key tests due to IGNORE_API_KEY_TESTS being set",
185+
);
186+
});
187+
return;
188+
}
189+
181190
testLLM(
182191
new Anthropic({
183192
model: "claude-3-5-sonnet-latest",

extensions/vscode/e2e/tests/SSH.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
import {
22
EditorView,
3-
TextEditor,
43
InputBox,
5-
Workbench,
64
Key,
7-
VSBrowser,
5+
TextEditor,
6+
Workbench,
87
} from "vscode-extension-tester";
98

9+
import { AutocompleteActions } from "../actions/Autocomplete.actions";
1010
import { DEFAULT_TIMEOUT } from "../constants";
11-
import { TestUtils } from "../TestUtils";
1211
import { SSHSelectors } from "../selectors/SSH.selectors";
13-
import { AutocompleteActions } from "../actions/Autocomplete.actions";
12+
import { TestUtils } from "../TestUtils";
1413

1514
describe("SSH", function () {
15+
if (process.env.IGNORE_SSH_TESTS === "true") {
16+
it("Skipping SSH tests", () => {
17+
console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set");
18+
});
19+
return;
20+
}
21+
1622
it("Should display completions", async () => {
1723
await TestUtils.waitForSuccess(async () => {
1824
await new Workbench().executeCommand(

0 commit comments

Comments
 (0)