This directory contains the test setup server used to provide user logins during load testing.
user-office-proposal-performance-tests/test-setup is a Node.js-based Express server deployed within the cluster or locally to provide login credentials.
- Environment Initialization:
- Loads environment variables from a
.envfile or from cluster secrets.
- Loads environment variables from a
- Database Connection Establishment:
- Establishes a connection to an Oracle database using
oracledb.
- Establishes a connection to an Oracle database using
- Express Server Setup:
- Creates an Express application to handle HTTP requests and provide user login endpoints.
- User Pre-population:
- Creates a predefined number of test users (500).
- Server Startup:
- Starts the Express server, listening on a specified port (default: 8100).
- Cleanup on Exit:
- Cleans up user data on termination.
-
Clone the Repository:
git clone https://github.com/UserOfficeProject/user-office-proposal-performance-tests cd user-office-proposal-performance-tests/test-setup -
Install Dependencies:
npm install
-
Configure
.env:- Create a
.envfile in the root directory or the parent directory, - Ensure all necessary environment variables are set, including database connection details and port number,using
env.exampleas a template. - For cluster deployments, ensure that necessary secrets are configured correctly using
Jenkinsfile.setupcluster.
- Create a
-
Start the Server:
node index.js # or node <script_name>.js -
Accessing Endpoints:
- Server's endpoints can be accessed on
http://localhost:<PORT>/<endpoint>, where<PORT>is the port number (default: 8100) and<endpoint>is the specific endpoint path. - The
/healthendpoint is available for checking the server's status. - The server is designed to provide endpoints for load testing.
- Server's endpoints can be accessed on
-
Local Development:
- Image Building: To build the Docker image, execute
fba-compose build proposal-performance-test. This command creates the container image based on theDockerfilein this directory. - Server Startup: The server is started by running
fba-compose up proposal-performance-testusing therundevtests.shscript.rundevtests.shis a script sets up environment variables for local set up.
- Image Building: To build the Docker image, execute
-
Cluster Deployment:
- Jenkinsfile.build:
- Image Building: The Docker image is built using the
Jenkinsfile.buildpipeline. This pipeline executes the necessary steps to create a container image based on theDockerfile. The resulting image is pushed to the Harbor registry:ghcr.io/isisbusapps/uop-performance-tests-setup:<TEST_SETUP_VERSION_TAG>.
- Image Building: The Docker image is built using the
- Server Startup:
- Cluster Deployment via Jenkins: The server is deployed within the cluster using the
run-cluster.shscript, which is triggered by theJenkinsfile.runclusterpipeline. This pipeline automates the deployment process within the cluster environment. - Local Cluster Deployment (CLI): For local testing using the cluster, the server can be deployed using the command:
npm run cluster-cli:start
- Cluster Deployment via Jenkins: The server is deployed within the cluster using the
- Jenkinsfile.build: