This guide provides instructions for setting up the PostgreSQL database roles and running Postman collection tests for the OLTP database project.
- PostgreSQL installed and running
- Node.js and pnpm package manager
- Newman (Postman CLI runner)
- Appropriate permissions to create database roles
When running the common_oltp_db script, you may encounter errors related to missing roles in your PostgreSQL database. These errors occur because the required role is not present in your database configuration.
A create-role.sh script has been created to add the missing role and resolve these issues.
-
Make the script executable:
chmod +x create-role.sh
-
Run the role creation script (choose one option):
Option 1: Run with default authentication (peer-auth or local superuser)
./create-role.sh
Option 2: Run with custom PostgreSQL credentials
PGUSER=your_pg_username PGPASSWORD=your_pg_password ./create-role.sh
-
Run the main database script:
# After successful role creation, run: ./common_oltp_db
- Run the
create-role.shscript after PostgreSQL is installed and running - Ideally execute once at system setup or after resetting your database
- Must be completed before running the
common_oltp_dbscript
Before running the Postman collection tests, you need to configure the environment variables:
- Update the environment file:
- Navigate to
/doc/postman_environment.json - Add the
accessTokenvalue in the JSON file
- Navigate to
After configuring the environment, execute the Postman collection tests:
pnpm run test:postman:group- Ensure PostgreSQL service is running before executing
create-role.sh - Verify you have sufficient privileges to create roles
- Check PostgreSQL logs if authentication fails
- Verify the
accessTokenis correctly set in the postman_environment.json file - Ensure all required dependencies are installed with
pnpm install - Check that Newman is properly installed globally or as a dev dependency
project/
├── doc/
│ └── postman_environment.json # Postman environment configuration
│ └── create-role.sh # Role creation script
If you continue to experience issues:
- Check PostgreSQL connection and permissions
- Verify all prerequisites are installed
- Review script output for specific error messages
- Ensure environment variables are correctly configured