Update test commands to run Ginkgo unit tests in verbose mode. Modify README and Taskfile to reflect changes in test execution and improve clarity on running unit tests.

This commit is contained in:
windyboy
2025-11-16 10:08:26 +08:00
parent 487a0acb48
commit 69fc8cf337
3 changed files with 8 additions and 13 deletions
+3 -8
View File
@@ -38,15 +38,10 @@ run-local: ## Run receiver directly via go run
@GO_ENV=$(GO_ENV) go run $(CMD) listen @GO_ENV=$(GO_ENV) go run $(CMD) listen
.PHONY: test .PHONY: test
test: ## Run unit tests (Ginkgo) test: ## Run unit tests (Ginkgo, verbose)
@command -v ginkgo >/dev/null || (echo "Please install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"; exit 1) @command -v ginkgo >/dev/null || (echo "Please install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"; exit 1)
@echo "Running Ginkgo unit test suites..." @echo "Running Ginkgo unit test suites (verbose)..."
@ginkgo -r ./cmd ./internal @ginkgo -r -v ./...
.PHONY: test-int
test-int: ## Run integration tests (requires Docker)
@echo "Running integration tests..."
@GO_ENV=$(GO_ENV) go test -tags=integration ./test/integration/...
.PHONY: test-int .PHONY: test-int
test-int: ## Run integration tests (requires Docker) test-int: ## Run integration tests (requires Docker)
+2 -2
View File
@@ -318,7 +318,7 @@ Dependencies are managed using Google Wire. To add a new dependency:
The project keeps tests close to the code that they exercise: The project keeps tests close to the code that they exercise:
- **Domain/adapter/app unit tests** live under `internal/**` and cover parsing, validation, orchestration, and adapters. Run them all with `task test` (or `make test`), which now uses the Ginkgo CLI to run unit test suites (`ginkgo -r ./cmd ./internal`). - **Domain/adapter/app unit tests** live under `internal/**` and cover parsing, validation, orchestration, and adapters. Run them all with `task test` (or `make test`), which now uses the Ginkgo CLI to run unit test suites in verbose mode (`ginkgo -r -v ./...`).
- **Integration tests** under `test/integration` spin up disposable TimescaleDB and NATS JetStream instances (via `testcontainers-go`) and execute a full ingestion flow. Use `task test-int` after ensuring Docker is running. - **Integration tests** under `test/integration` spin up disposable TimescaleDB and NATS JetStream instances (via `testcontainers-go`) and execute a full ingestion flow. Use `task test-int` after ensuring Docker is running.
- **Coverage goals** are tracked via `task coverage`, which produces both a coverage profile and an HTML report under `coverage/coverage.html`. - **Coverage goals** are tracked via `task coverage`, which produces both a coverage profile and an HTML report under `coverage/coverage.html`.
@@ -330,7 +330,7 @@ The project keeps tests close to the code that they exercise:
| Generate coverage html | `make coverage` | `task coverage` | | Generate coverage html | `make coverage` | `task coverage` |
| Lint (golangci-lint) | `make lint` | `task lint` | | Lint (golangci-lint) | `make lint` | `task lint` |
> Integration tests need Docker available on the host. Ginkgo-based unit tests or lint targets require the respective binaries (`go install github.com/onsi/ginkgo/v2/ginkgo@latest`, [golangci-lint install guide](https://golangci-lint.run/)). Use `task install-test` to bootstrap Ginkgo tooling before running `task test`, `task test-all`, or their `make` equivalents. > Integration tests need Docker available on the host. Ginkgo-based unit tests or lint targets require the respective binaries (`go install github.com/onsi/ginkgo/v2/ginkgo@latest`, [golangci-lint install guide](https://golangci-lint.run/)). Use `task install-test` to bootstrap Ginkgo tooling before running `task test`, `task test-all`, or their `make` equivalents. `make test` / `task test` run Ginkgo in verbose mode (`-v`), showing each spec for easier debugging.
## Message Flow ## Message Flow
+3 -3
View File
@@ -55,15 +55,15 @@ tasks:
GO_ENV=${GO_ENV:-dev} go run {{.cmd}} listen GO_ENV=${GO_ENV:-dev} go run {{.cmd}} listen
test: test:
desc: Run Ginkgo unit test suites desc: Run Ginkgo unit test suites (verbose)
cmds: cmds:
- | - |
if ! command -v ginkgo >/dev/null; then if ! command -v ginkgo >/dev/null; then
echo "Install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)" echo "Install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"
exit 1 exit 1
fi fi
- echo "Running Ginkgo unit test suites..." - echo "Running Ginkgo unit test suites (verbose)..."
- ginkgo -r ./cmd ./internal - ginkgo -r -v ./...
test-int: test-int:
desc: Run integration tests (requires Docker) desc: Run integration tests (requires Docker)