Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test-redis-cache-module/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "test-redis-cache-module"
version = "0"
requires-python = ">=3.12"

dependencies = [
"ipdb>=0.13.13",
"locust>=2.32.7",
"matplotlib>=3.10.1",
"memory-profiler>=0.61.0",
"redis>=5.2.1",
"sentry-sdk",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
10 changes: 0 additions & 10 deletions test-redis-cache-module/requirements.txt

This file was deleted.

12 changes: 5 additions & 7 deletions test-redis-cache-module/run-locust.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

# exit on first error
set -xe
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# create and activate virtual environment
python -m venv .venv
source .venv/bin/activate

locust
uv run locust
16 changes: 5 additions & 11 deletions test-redis-cache-module/run.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

# exit on first error
set -xe

# create and activate virtual environment
python -m venv .venv
source .venv/bin/activate

# Install (or update) requirements
python -m pip install -r requirements.txt
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

pkill redis-server || true
sleep 1
rm -rf dump.rdb
redis-server --daemonize yes

# Run program
python main.py
uv run python main.py
Comment on lines +5 to +13

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The script installs uv but doesn't update the current shell's PATH, causing the subsequent uv run command to fail if uv wasn't already installed.
Severity: HIGH

Suggested Fix

To make uv available in the current shell session, source the environment file created by the installer immediately after installation. Add source ~/.local/bin/env after the curl command that installs uv. Alternatively, you could add ~/.local/bin to the PATH manually with export PATH="$HOME/.local/bin:$PATH".

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: test-redis-cache-module/run.sh#L5-L13

Potential issue: After installing `uv` via its curl installer, the script immediately
calls `uv run`. The installer modifies shell profile files (e.g., `.bashrc`), but these
changes only apply to new shell sessions, not the currently running script.
Consequently, if `uv` is not pre-installed and its binary directory (`~/.local/bin`) is
not already in the `PATH`, the `uv run` command will fail with a "command not found"
error. Because `set -euo pipefail` is active, this error will cause the script to exit
prematurely. This issue also affects `run-locust.sh`.

Also affects:

  • run-locust.sh

Did we get this right? 👍 / 👎 to inform future reviews.

Loading