fix(infra) - Make file system interactive test check only tool call (#11055)

Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com>
This commit is contained in:
shishu314
2025-10-17 17:25:31 -04:00
committed by GitHub
parent 21163a1636
commit 0b20f88fc0
4 changed files with 19 additions and 12 deletions
@@ -7,7 +7,7 @@
import { expect, describe, it, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
describe.skip('Interactive file system', () => {
describe('Interactive file system', () => {
let rig: TestRig;
beforeEach(() => {
@@ -33,16 +33,16 @@ describe.skip('Interactive file system', () => {
const readCall = await rig.waitForToolCall('read_file', 30000);
expect(readCall, 'Expected to find a read_file tool call').toBe(true);
await run.expectText('1.0.0', 30000);
// Step 2: Write the file
const writePrompt = `now change the version to 1.0.1 in the file`;
await run.type(writePrompt);
await run.sendKeys('\r');
await rig.expectToolCallSuccess(['write_file', 'replace'], 30000);
const newFileContent = rig.readFile(fileName);
expect(newFileContent).toBe('1.0.1');
// Check tool calls made with right args
await rig.expectToolCallSuccess(
['write_file', 'replace'],
30000,
(args) => args.includes('1.0.1') && args.includes(fileName),
);
});
});
+9 -2
View File
@@ -628,7 +628,11 @@ export class TestRig {
);
}
async expectToolCallSuccess(toolNames: string[], timeout?: number) {
async expectToolCallSuccess(
toolNames: string[],
timeout?: number,
matchArgs?: (args: string) => boolean,
) {
// Use environment-specific timeout
if (!timeout) {
timeout = getDefaultTimeout();
@@ -642,7 +646,10 @@ export class TestRig {
const toolLogs = this.readToolLogs();
return toolNames.some((name) =>
toolLogs.some(
(log) => log.toolRequest.name === name && log.toolRequest.success,
(log) =>
log.toolRequest.name === name &&
log.toolRequest.success &&
(matchArgs?.call(this, log.toolRequest.args) ?? true),
),
);
},