Skip to content

CLI-179 add network test for install.sh script#121

Open
kirill-knize-sonarsource wants to merge 2 commits intomasterfrom
CLI-179
Open

CLI-179 add network test for install.sh script#121
kirill-knize-sonarsource wants to merge 2 commits intomasterfrom
CLI-179

Conversation

@kirill-knize-sonarsource
Copy link
Member

No description provided.

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Mar 19, 2026

CLI-179

@sonar-review-alpha
Copy link

sonar-review-alpha bot commented Mar 19, 2026

Summary

Adds an end-to-end test for install.sh that validates the script works by actually downloading and installing the sonar CLI binary. This tests real network paths against binaries.sonarsource.com to ensure the URL structure is correct across platforms. Also updates CLAUDE.md to document the new E2E test suite.

What reviewers should know

Start by reading the new test file tests/e2e/install-scripts.test.ts. Key implementation details: the test runs bash install.sh in an isolated temp HOME directory to avoid side effects, verifies the binary was installed to the expected path, and confirms it works by running the --help command. The test is skipped on Windows (line 29) and has a 120s timeout to account for download/install time. This is a real network test—it will actually hit binaries.sonarsource.com, so be aware of the external dependency when reviewing or running.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: The test logic is sound and the path assertions correctly match what install.sh actually does. One genuine concern before this is merge-safe.

🗣️ Give feedback

() => {
const scriptPath = join(scriptDir, 'install.sh');

const scriptContent = readFileSync(scriptPath, 'utf-8');

Choose a reason for hiding this comment

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

The test downloads the exact version hardcoded in install.sh (version="0.6.1.603", line 76). If install.sh is ever bumped to a new version number before that version's artifacts are published to binaries.sonarsource.com, this test will fail in CI with a 404 or download error.

Is there a CI ordering guarantee that CDN publish always precedes an install.sh version bump landing on the main branch? If not, consider whether the test should skip or be tagged separately from the standard integration suite when run against an unreleased version.

  • Mark as noise

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

LGTM! ✅

🗣️ Give feedback

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: The previous concern about version ordering hasn't been addressed — the question of whether CI guarantees CDN publish precedes an install.sh version bump still stands and needs a response before this merges.

🗣️ Give feedback

Copy link
Contributor

@damien-urruty-sonarsource damien-urruty-sonarsource left a comment

Choose a reason for hiding this comment

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

I think it's a good start, but I have couple of comments:

  • how do you ensure the test is run only on linux/mac? If someone on Windows checks out the project, the test will fail
  • I would maybe put this test in a separate folder, it's yet different than integration tests. Maybe end-to-end, or install?

Also some more observations or nice-to-have:

  • I think the test is doing the bare minimum, it's fine for now, we will probably include more tests soon
  • At some point if we have more tests like this one, we could also build a "install tests harness", similar to what we have for integration tests. I can already see a lot of setup boilerplate can be factorized in a single place

@sonarqubecloud
Copy link

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

LGTM! ✅

🗣️ Give feedback

Copy link
Contributor

@damien-urruty-sonarsource damien-urruty-sonarsource left a comment

Choose a reason for hiding this comment

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

LGTM, do we need to create a separate ticket to test the Windows install script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants