A tool to help Event-driven asynchronized microservice system do intergrated.
The image below shows how CCTS work with ralated services and their dependencies.
CCTS system combines contract test and log from end-2-end test to ensure the system behavior qualified your desire.
The details of the document can be found at here or here on hackmd.
The process flow below shows the difference stage when using CCTS.
The marix below shows the http api endpoint that how we act with CCTS service.
path | method | note |
---|---|---|
/conductCCTS |
POST | To conduct and get CCTS report |
/cleanDB |
POST | clean DB data |
CCTS Document is a file and structure to describe a SAGA flow for a system that are going to test .
CCTS Message Specification is a structure to describe certain events that will be recognized by CCTS service.
database_dump
is dump from my own mongoDB, includingCCTSTest
,CCTSResult
andEventlogs
.doc
provide handbook for CCTS, includingCCTS Message Spce.
andCCTS Document Spec.
.imgs
to save image file for README.mdbuild.sh
is how maven build CCTS and make docker image.docker-compose.yml
integrates all related project as a cluster service.mongo-init.js
is helping initialization for mongodb configuration indocker-compose.yml
.start-CCTS.sh
is a single line to build and start whole CCTS project.
Video Guide: https://youtu.be/X212bWHwBY0
- Make sure
docker
is available in your system. - Make sure
maven
is available in your system. - Make sure
git
is available in your system. - Linux distro is recommanded for a enviroment
- CCTS is developed by SpringBoot framework release 2.6.7
- CCTS language level is setting in 17
- In others word, JDK-17 or compatible release is essential.
- I use
azul-17
A.K.A.zulu
JDK for a JDK-17 implement.
- A brave heart that never gives up in seeking higher goals.
-
CCTS 本體$\rightarrow$ https://github.com/DF-wu/CCTS
-
CCTS 開發時使用的 pact broker
$\rightarrow$ https://github.com/DF-wu/ContractTestingBoilerplate/tree/master -
CCTS 開發時使用的rabbitmq範本
$\rightarrow$ https://github.com/DF-wu/RabbitMQ_server -
CCTS使用的儲值範例系統,修改自PDVPS專案。
- orchestrator
$\rightarrow$ https://github.com/DF-wu/CCTS_poc_orchestrator - point service
$\rightarrow$ https://github.com/DF-wu/CCTS_poc_points - payment service
$\rightarrow$ https://github.com/DF-wu/CCTS_poc_payment - logging service
$\rightarrow$ https://github.com/DF-wu/CCTS_poc_logging
- orchestrator
- I containerlized whole CCTS to an single docker compose. Should be work well. The steps of deployment:
- Determine a destination for deploying CCTS. Docker is requirment. I recommand most popular Linux distro. The demonstraion is using arch-based manjaro Linux
sh start-CCTS.sh
- Done. Container YYDS.
- Clone all related project which was mentioned above.
- First for Pact broker.
- Get into the folder,chage the configuration by your requirement in
docker-compose.yml
。The default exposed port is8282
-
docker compose up -d
. Done。 - Yes, this service has been containerlized
- Get into the folder,chage the configuration by your requirement in
- Deploy RabbitMQ.
- Get into the folder.
- change the configuration in
docker-compose.yml
. The definition of enviroment variables should be found in official docker image release in docker hub. Below for current setting:- rabbitmq outside port:
10109
- rabbitmq management port:
10110
- RabbitMQ management username:
soselab
- RabbitMQ management password:
soselab401
- rabbitmq outside port:
-
docker compose up -d
. - Done. Container YYDS again.
- Deploy Database. CCTS default use mongoDB .
- You can find thousand of guidence for deploy a mongodb container. Go and select what you like.
- I use Mongo Atlas while developing.
- The essential setting for CCTS list as below
- username:
soselab
- password:
soselab401
- DB name:
CCTS
- username:
- Deploy CCTS.
- Get into the folder.
- Change related setting if you changed it before.
- First for rabbitMQ.
- This is for RabbitMQ itself configuration. Configuration file is located in
src/main/java/tw/dfder/ccts/configuration/RabbitmqConfig.java
. - For Spring Rabbitmq lib.This is Springboot Configuration. Connection setting is located in
src/main/resources/application.yml
. The part would be seen like this. replace${VARIABLE}
align your enviroment.rabbitmq: username: ${USERNAME} password: ${PASSOWORD} host: ${RABBITMQ_HOST} port: ${RABBITMQ_PORT} virtual-host: / listener: simple: # 手動ack, 確保訊息完整處理 acknowledge-mode: manual
- This is for RabbitMQ itself configuration. Configuration file is located in
- Set the database.
- The database configuration is defined in sprigboot configuration as known as
application.properties
. CCTS useyaml
format asapplication.yaml
to replace it. The part would be seen like this. replace${VARIABLE}
align your enviroment.spring: data: mongodb: uri: mongodb+srv://${USERNAME}:${PASSWORD}@${DATABASE_ADDRESS}/CCTS?retryWrites=true&w=majority
- The database configuration is defined in sprigboot configuration as known as
- Set up for Pact broker
- The configuration is defined in springboot configuration AKA
application.properties
orapplication.yaml
. - This part of setting in configuration file would be seen like:
replace
CCTS: pact_broker: http://${BROKER_ADDRESS}:${BROKER_PORT}
${VARIABLE}
align your enviroment.
- The configuration is defined in springboot configuration AKA
- Set up anything else you need to connect to CCTS.
- Deploy CCTS
- Thers is serveral way to deploy a SpringBoot programe. Go and choose what you want.
- I recommand to pack whole programe as a
jar
file or acontainer
for deployment.
- Deploy PDVPS (Optional)
- Specify a folder and get into it.
- Clone corresponding repo.
- Change Rabbitmq connection setting in Springboot configuration file for each project if needed.
- Change database(MongoDB) connection in Springboot configuration file for each project if needed.
- Make sure RabbitMQ configuration about queue, exchange, top or etc. is corrosponding to right assignment.
Refer to the previous steps
- run it as a
jar
file or run it in IDE.
- Done.