mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(infra) - Fix flake for file interactive system (#11019)
Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { expect, describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import { TestRig, printDebugInfo } from './test-helper.js';
|
||||
import { TestRig } from './test-helper.js';
|
||||
|
||||
describe('Interactive file system', () => {
|
||||
let rig: TestRig;
|
||||
@@ -18,7 +18,7 @@ describe('Interactive file system', () => {
|
||||
await rig.cleanup();
|
||||
});
|
||||
|
||||
it.skip('should perform a read-then-write sequence', async () => {
|
||||
it('should perform a read-then-write sequence', async () => {
|
||||
const fileName = 'version.txt';
|
||||
rig.setup('interactive-read-then-write');
|
||||
rig.createFile(fileName, '1.0.0');
|
||||
@@ -40,18 +40,7 @@ describe('Interactive file system', () => {
|
||||
await run.type(writePrompt);
|
||||
await run.type('\r');
|
||||
|
||||
const toolCall = await rig.waitForAnyToolCall(
|
||||
['write_file', 'replace'],
|
||||
30000,
|
||||
);
|
||||
|
||||
if (!toolCall) {
|
||||
printDebugInfo(rig, run.output, { toolCall });
|
||||
}
|
||||
|
||||
expect(toolCall, 'Expected to find a write_file or replace tool call').toBe(
|
||||
true,
|
||||
);
|
||||
await rig.expectToolCallSuccess(['write_file', 'replace'], 30000);
|
||||
|
||||
const newFileContent = rig.readFile(fileName);
|
||||
expect(newFileContent).toBe('1.0.1');
|
||||
|
||||
@@ -585,6 +585,34 @@ export class TestRig {
|
||||
);
|
||||
}
|
||||
|
||||
async expectToolCallSuccess(toolNames: string[], timeout?: number) {
|
||||
// Use environment-specific timeout
|
||||
if (!timeout) {
|
||||
timeout = getDefaultTimeout();
|
||||
}
|
||||
|
||||
// Wait for telemetry to be ready before polling for tool calls
|
||||
await this.waitForTelemetryReady();
|
||||
|
||||
const success = await poll(
|
||||
() => {
|
||||
const toolLogs = this.readToolLogs();
|
||||
return toolNames.some((name) =>
|
||||
toolLogs.some(
|
||||
(log) => log.toolRequest.name === name && log.toolRequest.success,
|
||||
),
|
||||
);
|
||||
},
|
||||
timeout,
|
||||
100,
|
||||
);
|
||||
|
||||
expect(
|
||||
success,
|
||||
`Expected to find successful toolCalls for ${JSON.stringify(toolNames)}`,
|
||||
).toBe(true);
|
||||
}
|
||||
|
||||
async waitForAnyToolCall(toolNames: string[], timeout?: number) {
|
||||
// Use environment-specific timeout
|
||||
if (!timeout) {
|
||||
|
||||
Reference in New Issue
Block a user