Skip to content

Add integration test for extensions#9177

Merged
chrstnb merged 3 commits into
mainfrom
cb/e2etest
Sep 25, 2025
Merged

Add integration test for extensions#9177
chrstnb merged 3 commits into
mainfrom
cb/e2etest

Conversation

@chrstnb

@chrstnb chrstnb commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

TLDR

Adding the first (simple) integration test for installing, updating, and listing a local extension

Dive Deeper

Reviewer Test Plan

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

@chrstnb chrstnb requested a review from a team as a code owner September 23, 2025 02:47
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @chrstnb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes foundational integration testing for the extension management features. It adds a new test file that simulates the lifecycle of a local extension, from installation and verification to updating and uninstallation. To facilitate this, the TestRig utility has been enhanced with a runCommand method, providing a robust way to interact with the CLI within the test environment.

Highlights

  • New Integration Test: Introduced the first integration test specifically for the extension management system, covering the installation, listing, and updating of local extensions.
  • TestRig Enhancement: Added a new runCommand utility method to the TestRig class, allowing tests to execute CLI commands and capture their standard output and error streams, including handling standard input.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Sep 23, 2025

Copy link
Copy Markdown

Size Change: -2 B (0%)

Total Size: 17.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 17.4 MB -2 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 830 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the first integration test for extension management, which is a valuable addition for ensuring the stability of these features. The changes also include a new helper method in TestRig for executing commands. My review focuses on improving the test's robustness and the maintainability of the test helper code. I've identified some duplicated logic that should be refactored and opportunities to make the tests more isolated and the test rig API safer to use.

Comment thread integration-tests/extensions-install.test.ts Outdated
Comment thread integration-tests/extensions-install.test.ts Outdated
Comment on lines +309 to +358
runCommand(
args: string[],
options: { stdin?: string } = {},
): Promise<string> {
const commandArgs = [this.bundlePath, ...args];

const child = spawn('node', commandArgs, {
cwd: this.testDir!,
stdio: 'pipe',
});

let stdout = '';
let stderr = '';

if (options.stdin) {
child.stdin!.write(options.stdin);
child.stdin!.end();
}

child.stdout!.on('data', (data: Buffer) => {
stdout += data;
if (env.KEEP_OUTPUT === 'true' || env.VERBOSE === 'true') {
process.stdout.write(data);
}
});

child.stderr!.on('data', (data: Buffer) => {
stderr += data;
if (env.KEEP_OUTPUT === 'true' || env.VERBOSE === 'true') {
process.stderr.write(data);
}
});

const promise = new Promise<string>((resolve, reject) => {
child.on('close', (code: number) => {
if (code === 0) {
this._lastRunStdout = stdout;
let result = stdout;
if (stderr) {
result += `\n\nStdErr:\n${stderr}`;
}
resolve(result);
} else {
reject(new Error(`Process exited with code ${code}:\n${stderr}`));
}
});
});

return promise;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The new runCommand method duplicates a significant amount of logic from the existing run method (lines 178-307). This includes process spawning, handling stdout and stderr streams, and managing the child process lifecycle with a Promise. To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, this common logic should be extracted into a private helper method. Both run and runCommand can then call this helper and apply their specific argument processing and output handling.

Comment thread integration-tests/test-helper.ts
@chrstnb chrstnb enabled auto-merge September 25, 2025 23:35
@chrstnb chrstnb added this pull request to the merge queue Sep 25, 2025
Merged via the queue into main with commit 463e5d5 Sep 25, 2025
18 checks passed
@chrstnb chrstnb deleted the cb/e2etest branch September 25, 2025 23:51
geoffdowns pushed a commit to geoffdowns/gemini-cli that referenced this pull request Sep 26, 2025
dtometzki pushed a commit to dtometzki/gemini-cli that referenced this pull request Sep 26, 2025
jkcinouye pushed a commit that referenced this pull request Sep 29, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Oct 4, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
cocosheng-g pushed a commit that referenced this pull request May 6, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants