cloud-testing-agent
v1.0.7
Published
<p align="center"> <a href="https://coopengo.com" target="blank"><img src="https://coopengo.com/wp-content/uploads/2020/09/Coopengo_Logo_RVB.svg" width="200" alt="Nest Logo" /></a> </p>
Readme
Description
The Cloud Testing Agent is a purpose-built tool crafted for the testing of Coog cloud application services. Its design enables seamless integration with the entire application delivery pipeline within the Coopengo cloud application platform.
Table of Contents
- Description
- Table of Contents
- Prerequisites
- Installation
- Running the app
- Test
- Swagger Documentation
- Custom variables
- Seeding
- Releases
- SonarQube
- Run the scan
- Docker
- How to generate docker image thanks to the following command
- License
Prerequisites
- Node.js 24.x (Active LTS)
- Yarn 4 (via Corepack)
- Docker (optional, for container builds/runs)
- Access to Docker Official DHI registry (
dhi.io) if building the hardened image
Enable Corepack (one-time):
corepack enableInstallation
Install dependencies
$ yarn installEnable environment variables using the shell extension direnv:
$ cp .envrc.example .envrc
$ direnv allowPlease be aware that if your database hasn't undergone the initialization process, specifically with regards to the 'user' table, it's essential to perform a pre-initialization step. This entails the creation of two user accounts: one as a super administrator named 'superadmin,' and the other as a user named 'coog.' Ensure that 'coog' is granted permissions to read, create, delete, and update all database objects except for the 'user' table.
See section Seeding below.
Running the app
# Development - Start application
$ yarn start
# Watch mode - Start application in watch mode
$ yarn start:dev
# Production mode - Start built application
$ yarn start:prodBy default, the application is running at http://localhost:3000
Test
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:covSwagger Documentation
By default, while the application is running, open your browser and navigate to http://localhost:3000/api to see the Swagger UI:

Custom variables
By default, the application runs on port 3000, but you can customize this value using SERVER_PORT:
export SERVER_PORT=7000Other useful variables:
# Enable automatic schema update on startup (default: false)
export DB_AUTO_SCHEMA=true
# Shared token used by internal workers to update task reports
export INTERNAL_TOKEN=change-me
# Base URL used by workers to call back into the API
export SERVICE_BASE_URL=http://127.0.0.1:7000Seeding
Seeding is used to insert data into the database. The seeding files are stored in modules/orm/seeders directory.
npx cross-env NODE_ENV=dev yarn orm seeder:run # seeds dataReleases
When a commit to the main branch has Release-As: x.x.x (case insensitive) in the commit body, Release Please will open a new pull request for the specified version.
Empty commit example:
git commit --allow-empty -m "chore: release 0.2.0" -m "Release-As: 0.2.0"results in the following commit message:
chore: release 2.0.0
Release-As: 2.0.0SonarQube
Execute the Scanner
Running a SonarQube analysis is straighforward. Locally, you just need to execute the following commands in your project's folder.
Generate pre-scan reports
Generate unit test coverage report
yarn test:covGenerate security vulnaribility report
./scripts/dependency-check.sh -f ALL -s . --out reports/dependency-check --project "coog-cloud-agent"Run the scan
sonar-scanner \
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY \
-Dsonar.sources=$SONARQUBE_REPO \
-Dsonar.host.url=$SONARQUBE_URL \
-Dsonar.token=$SONARQUBE_TOKENor thanks to the following docker command :
docker run \
--rm \
-e SONAR_HOST_URL="$(SONARQUBE_URL)" \
-e SONAR_SCANNER_OPTS="-Dsonar.projectKey=$(SONARQUBE_PROJECT_KEY)" \
-e SONAR_TOKEN="$(SONARQUBE_TOKEN)" \
-v "$(SONARQUBE_REPO):/usr/src" \
sonarsource/sonar-scanner-cliDocker
How to generate docker image thanks to the following command
To build:
docker build --file ./build/Dockerfile --no-cache --progress=plain -t cloud-testing-agent:latest -t cloud-testing-agent:{{VERSION}} . |& tee build_output.txtNotes:
- The Dockerfile uses Docker Official DHI images by default. Make sure you're authenticated to
dhi.io. - Default DHI tags in
build/Dockerfiletarget Debian 12 + Node 24.
How to run cloud-testing-agent docker image
Before starting the service, we will create a network for our container, so you can more easily choose which one to use and when.
docker network create cloud-coopengoTo run:
docker compose -f "./build/compose.yaml" -p "cloud-testing" up --force-recreate -d The service will be available at http://0.0.0.0:3000/ .
License
Nest is MIT licensed.
