test-with-postgres
/test-with-postgres
Run unit tests that require PostgreSQL. Use this skill when the user wants to run tests with PostgreSQL database backend. Automatically handles checking for and configuring a PostgreSQL Docker container.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.
What it does and when to use it
Run unit tests that require PostgreSQL. Use this skill when the user wants to run tests with PostgreSQL database backend. Automatically handles checking for and configuring a PostgreSQL Docker container.
Original author description
Run unit tests that require PostgreSQL. Use this skill when the user wants to run tests with PostgreSQL database backend. Automatically handles checking for and configuring a PostgreSQL Docker container.
How it works
- Instructions
- Common test paths
- Example Usage
- Cleanup
- Notes
SKILL.md preview
---
name: test-with-postgres
description: Run unit tests that require PostgreSQL. Use this skill when the user wants to run tests with PostgreSQL database backend. Automatically handles checking for and configuring a PostgreSQL Docker container.
allowed-tools: Bash(docker *), Bash(go *)
---
# Run Unit Tests with PostgreSQL
You are helping run unit tests that require PostgreSQL.
## Instructions
### Starting PostgreSQL
PostgreSQL must be running before tests can execute. Use Docker to start a PostgreSQL instance:
```bash
# Check if postgres container is already running
docker ps --filter name=storj_unit_tests_postgres --format '{{.Names}}'
# If not running, start it:
docker run --rm -d -p 5433:5432 --name storj_unit_tests_postgres -e POSTGRES_PASSWORD=tmppass postgres:17
# Wait for postgres to be ready (retry until successful)
until docker exec storj_unit_tests_postgres psql -h localhost -U postgres -d postgres -c "select 1" > /dev/null 2>&1; do
echo "Waiting for postgres server..."
sleep 1
done
# Create test database
docker exec storj_unit_tests_postgres psql -h localhost -U postgres -c "create database teststorj;"
```
Alternatively, run `testsuite/postgres-dev.sh` which handles all setup automatically.
### Running Tests
1. **If test name is provided in arguments**:
- Find the package containing the test using Grep
- Run the test with PostgreSQL configured
2. **If only package path is provided**:
- Run all tests in that package with PostgreSQL configured
3. **Command format**:
```bash
go test -v ./package/path -run TestName -postgres-test-db 'postgres://postgres:tmppass@localhost:5433/teststorj?sslmode=disable'
```
4. **Report test results**:
- Show whether tests passed or failed
- List all subtests that ran
- If tests failed, offer to help investigate the failures
5. **Stop the Docker container after tests complete**:
```bash
docker rm -f storj_unit_tests_postgres
```
## Common test paths
Some common test paths in the Storj codebase:
- `./satellite/metabase` - Metabase tests
- `./satellite/metainfo` - Metainfo API tests
- `./satellite/satellitedb` - Database tests
## Example Usage
```bash
# Run a specific test
go test -v ./satellite/metainfo -run TestEndpoint_Object_No_StorageNodes -postgres-test-db 'postgres://postgres:tmppass@localhost:5433/teststorj?sslmode=disable'
# Run all tests in a package
go test -v ./satellite/metabase -postgres-test-db 'postgres://postgres:tmppass@localhost:5433/teststorj?sslmode=disable'
# Run tests with timeout
go test -v -timeout 10m ./satellite/metabase -run TestLoop -postgres-test-db 'postgres://postgres:tmppass@localhost:5433/teststorj?sslmode=disable'
```
## Cleanup
To stop the PostgreSQL container when done:
```bash
docker rm -f storj_unit_tests_postgres
```
## Notes
- The container uses port 5433 to avoid conflicts with any local PostgreSQL installation on the default port 5432
- Tests automatically create isolated test databases for each test run
- Use `STORJ_TEST_POSTGRES='omit'` to skip PostgreSQL tests
Versions
The database has no other skills named test-with-postgres.
Database snapshot: 13.11.2026 · package version d8ec9296a3eb (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100typescript-testing-backend
Use when writing or reviewing TypeScript backend tests — Jest unit tests for services/controllers (mocked Prisma) or Supertest integration tests against a real isolated PostgreSQL test database. Triggers on edits to `*.service.test.ts`, `*.controller.test.ts`,… - 100azure-postgres-ts
|" Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg… - 100testing
Run and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests, fix test failures, debug integration tests, troubleshoot Docker/database container issues, or add new tests. Also use when… - 100azure-postgres-ts
Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg… - 100configure-backend-tests
Use when a backend service needs a test setup or its tests mock the database. Builds the pyramid - pure unit tests, real-Postgres integration via testcontainers, HTTP-level tests, OpenAPI contract tests, factories and CI-ready layout (Vitest, go test, pytest). - 100creating-oracle-to-postgres-migration-integration-tests
Creates integration test cases for .NET data access artifacts during Oracle-to-PostgreSQL database migrations. Generates DB-agnostic xUnit tests with deterministic seed data that validate behavior consistency across both database systems. Use when creating integration tests for…