Compare commits

...

2 Commits

Author SHA1 Message Date
Vinícius Lourenço
89ce3e2ebf docs(tests): pass --no-race to local stacks 2026-10-20 20:40:56 -03:00
Vinícius Lourenço
08522eb131 test: add --no-race to build local stacks without the race detector 2026-10-20 20:33:49 -03:00
8 changed files with 31 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ You are the Playwright Test Healer for the SigNoz E2E suite. You debug and fix r
The E2E backend stack must be up. If `tests/e2e/.env.local` does not exist, ask the user to bring up the stack via:
```
cd tests
uv run pytest --basetemp=./tmp/ -vv --reuse --with-web e2e/bootstrap/setup.py::test_setup
uv run pytest --basetemp=./tmp/ -vv --reuse --no-race --with-web e2e/bootstrap/setup.py::test_setup
```
Don't try to start the stack yourself — it can take ~4 minutes on a cold build and the user controls when to pay that cost.

View File

@@ -0,0 +1,9 @@
---
paths:
- "tests/**"
- "docs/contributing/tests/**"
---
# Local test stacks
- **Pass `--no-race` to every local stack bring-up**, integration and e2e: `test_setup`, `--rebuild`, and suite runs that create their own SigNoz. `make py-test-setup` does not pass it; run its pytest command from `tests/` with the flag added. CI keeps the race detector.

View File

@@ -37,12 +37,16 @@ COPY ./ee/ ./ee/
COPY ./pkg/ ./pkg/
COPY ./templates /root/templates
# Empty builds without the race detector. Declared here so changing it
# keeps the layers above cached.
ARG RACE=-race
# Invoked directly instead of via make so Makefile changes don't invalidate
# this layer; the Makefile's git-derived ldflags resolve to empty in here
# anyway (.git is dockerignored).
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GOARCH=${TARGETARCH} GOOS=${OS} go build -C ./cmd/enterprise -race -tags timetzdata -o /root/signoz \
GOARCH=${TARGETARCH} GOOS=${OS} go build -C ./cmd/enterprise ${RACE} -tags timetzdata -o /root/signoz \
-ldflags "-s -w \
-X github.com/SigNoz/signoz/pkg/version.version=integration \
-X github.com/SigNoz/signoz/pkg/version.variant=enterprise \

View File

@@ -59,12 +59,16 @@ COPY ./ee/ ./ee/
COPY ./pkg/ ./pkg/
COPY ./templates /root/templates
# Empty builds without the race detector. Declared here so changing it
# keeps the layers above cached.
ARG RACE=-race
# Invoked directly instead of via make so Makefile changes don't invalidate
# this layer; the Makefile's git-derived ldflags resolve to empty in here
# anyway (.git is dockerignored).
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GOARCH=${TARGETARCH} GOOS=${OS} go build -C ./cmd/enterprise -race -tags timetzdata -o /root/signoz \
GOARCH=${TARGETARCH} GOOS=${OS} go build -C ./cmd/enterprise ${RACE} -tags timetzdata -o /root/signoz \
-ldflags "-s -w \
-X github.com/SigNoz/signoz/pkg/version.version=integration \
-X github.com/SigNoz/signoz/pkg/version.variant=enterprise \

View File

@@ -49,6 +49,8 @@ This command will:
The `--with-web` flag builds the frontend into the SigNoz container — required for E2E. The build takes ~4 mins on a cold start; later builds are incremental.
Add `--no-race` to build SigNoz without the race detector. CI keeps it on.
### Rebuilding After Source Changes
The `--with-web` image bakes the built frontend in, so neither backend nor frontend changes are picked up while `--reuse` keeps the container running. `--rebuild` fixes that for both: it kills the SigNoz container, rebuilds the image incrementally (go build cache + pnpm store — a frontend-only change rebuilds in about a minute), and starts a fresh one while databases, mocks, migrations, and the seeder stay reused. The setup command above passes it, so the iteration loop is: change code → re-run the setup command → re-run your specs. `--rebuild` requires `--reuse` and cannot be combined with `--teardown` or `--clean`.
@@ -356,6 +358,7 @@ The same pytest flags integration tests expose work here, since E2E reuses the s
- `--teardown` — tear everything down.
- `--clean` — prune the docker build caches, forcing the next image build to start cold.
- `--with-web` — build the frontend into the SigNoz container. **Required for E2E**; integration tests don't need it.
- `--no-race` — build SigNoz without the race detector. CI keeps it. Applies when the image is built: a fresh stack or `--rebuild`.
- `--sqlstore-provider`, `--postgres-version`, `--clickhouse-version`, etc. — see `docs/contributing/tests/integration.md`.
## What should I remember?

View File

@@ -258,6 +258,7 @@ Tests can be configured using pytest options:
- `--clickhouse-version` — ClickHouse version, also used for ClickHouse Keeper (default: `25.12.5`)
- `--schema-migrator-version` — SigNoz schema migrator version (default: `v0.144.9`)
- `--with-web` — Build the frontend into the SigNoz image (required for e2e)
- `--no-race` — Build SigNoz without the race detector, for a faster local stack. CI keeps it. Applies when the image is built: a fresh stack or `--rebuild`.
Example:

View File

@@ -88,6 +88,12 @@ def pytest_addoption(parser: pytest.Parser):
default=False,
help="Build and run with web. Run pytest --basetemp=./tmp/ -vv --with-web src/bootstrap/setup::test_setup to setup your local dev environment with web.",
)
parser.addoption(
"--no-race",
action="store_true",
default=False,
help="Build the signoz image without the race detector, for faster local stacks. CI keeps it. Applies when the image is built: a fresh stack or --rebuild.",
)
parser.addoption(
"--sqlstore-provider",
action="store",

View File

@@ -70,6 +70,7 @@ def create_signoz(
f"TARGETARCH={arch}",
"--build-arg",
f"ZEUSURL={zeus.container_configs['8080'].base()}",
*(["--build-arg", "RACE="] if pytestconfig.getoption("--no-race") else []),
str(context),
],
check=True,