Merge pull request #3950 from continuedev/nate/ignore-api-key-tests

skip llm tests on forks
This commit is contained in:
Nate Sesti 2025-02-04 12:07:04 -08:00 • committed by GitHub
commit de6ba3116b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 20 deletions

View file

@ -285,6 +285,7 @@ jobs:
cd core
npm test
env:
IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
@ -443,6 +444,7 @@ jobs:
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
if: ${{ github.event.pull_request.head.repo.fork == false }}
- name: Set up Xvfb
run: |
@ -452,7 +454,7 @@ jobs:
- name: Run e2e tests
run: |
cd extensions/vscode
TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
env:
DISPLAY: :99

View file

@ -246,6 +246,7 @@ export class CompletionProvider {
completionOptions,
cacheHit,
filepath: helper.filepath,
numLines: completion.split("\n").length,
completionId: helper.input.completionId,
gitRepo: await this.ide.getRepoName(helper.filepath),
uniqueId: await this.ide.getUniqueId(),

View file

@ -1,10 +1,4 @@
import {
Position,
Range,
RangeInFile,
RangeInFileWithContents,
TabAutocompleteOptions,
} from "../..";
import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../..";
import { AutocompleteCodeSnippet } from "../snippets/types";
export type RecentlyEditedRange = RangeInFile & {
@ -42,6 +36,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions {
modelName: string;
completionOptions: any;
cacheHit: boolean;
numLines: number;
filepath: string;
gitRepo?: string;
completionId: string;

View file

@ -26,7 +26,7 @@ export class DefaultCrawler {
});
if (!resp.ok) {
const text = await resp.text();
throw new Error(`Failed to crawl site: ${text}`);
throw new Error(`Failed to crawl site (${resp.status}): ${text}`);
}
const json = (await resp.json()) as PageData[];
return json;

View file

@ -152,11 +152,15 @@ describe("DocsCrawler", () => {
);
commonDocsSites.forEach((url) => {
test(`Default crawler common site: ${url}`, async () => {
const { pages, crawler } = await runCrawl(url);
expect(pages.length).toBeGreaterThanOrEqual(1);
expect(crawler).toEqual("default");
});
test(
`Default crawler common site: ${url}`,
async () => {
const { pages, crawler } = await runCrawl(url);
expect(pages.length).toBeGreaterThanOrEqual(1);
expect(crawler).toEqual("default");
},
TIMEOUT_MS,
);
});
});

View file

@ -178,6 +178,15 @@ function testLLM(
}
describe("LLM", () => {
if (process.env.IGNORE_API_KEY_TESTS === "true") {
test("Skipping API key tests", () => {
console.log(
"Skipping API key tests due to IGNORE_API_KEY_TESTS being set",
);
});
return;
}
testLLM(
new Anthropic({
model: "claude-3-5-sonnet-latest",

View file

@ -1,18 +1,24 @@
import {
EditorView,
TextEditor,
InputBox,
Workbench,
Key,
VSBrowser,
TextEditor,
Workbench,
} from "vscode-extension-tester";
import { DEFAULT_TIMEOUT } from "../constants";
import { TestUtils } from "../TestUtils";
import { SSHSelectors } from "../selectors/SSH.selectors";
import { AutocompleteActions } from "../actions/Autocomplete.actions";
import { DEFAULT_TIMEOUT } from "../constants";
import { SSHSelectors } from "../selectors/SSH.selectors";
import { TestUtils } from "../TestUtils";
describe("SSH", function () {
if (process.env.IGNORE_SSH_TESTS === "true") {
it("Skipping SSH tests", () => {
console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set");
});
return;
}
it("Should display completions", async () => {
await TestUtils.waitForSuccess(async () => {
await new Workbench().executeCommand(