https://github.com/manomanotech/pact-graph-network
Generates a big overview of dependencies between microservices using pact-broker
https://github.com/manomanotech/pact-graph-network
contract-testing pact-broker testing
Last synced: 11 months ago
JSON representation
Generates a big overview of dependencies between microservices using pact-broker
- Host: GitHub
- URL: https://github.com/manomanotech/pact-graph-network
- Owner: ManoManoTech
- License: mit
- Created: 2022-12-02T14:45:57.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-02T21:37:54.000Z (over 2 years ago)
- Last Synced: 2025-04-05T22:59:31.054Z (11 months ago)
- Topics: contract-testing, pact-broker, testing
- Language: Rust
- Homepage:
- Size: 1.52 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pact graph network
[](https://choosealicense.com/licenses/mit/)
[](https://github.com/ManoManoTech/pact-graph-network/actions)
[](https://www.rust-lang.org/)
> A command line to generate dependency patterns between microservices using pact-broker data.
Available for linux, alpine and OSX.
## Broker APIs
1. First, request `$PACT_BROKER_URL/pacts/latest` to get the list of all contracts (e.g. `pacts`) ;
2. then, for each contract object get the URL to latest version of contract, _e.g._ `_links._self[0].href`
> http://$PACT_BROKER_URL/pacts/provider/foo-provide/consumer/bar-consume/latest
3. and use it to fetch contract details, i.e. all interactions ;
# Table of contents
- [Pact graph network](#pact-graph-network)
- [Broker APIs](#broker-apis)
- [Table of contents](#table-of-contents)
- [Screenshots](#screenshots)
- [Tech Stack](#tech-stack)
- [Features](#features)
- [How to install](#how-to-install)
- [Usage](#usage)
- [Basic Auth](#basic-auth)
- [Bearer Auth](#bearer-auth)
- [Environment Variables](#environment-variables)
- [Options](#options)
- [Environment Variables](#environment-variables-1)
- [Feedback](#feedback)
- [License](#license)
## Screenshots
## Tech Stack
This project is created with:
- [rust](https://www.rust-lang.org/) 🦀
- [D3js](https://d3js.org/)
## Features
- [x] generate an html report
- [x] generate an edge bundling chart
- [x] generate a force directed layout chart
- [x] exclude sevices with pattern
- [ ] filter only services
- [X] add support fort Pact Broker authentification (Basic Auth + Bearer Based)
## How to install
```bash
# Download the binary
VERSION=0.7.2
curl -L -o $HOME/.local/bin/pact-graph-network \
https://github.com/ManoManoTech/pact-graph-network/releases/download/v${VERSION}/pact-graph-network_x86_64-unknown-linux-gnu
# Make it executable
chmod u+x $HOME/.local/bin/pact-graph-network
```
## Usage
Generate the graph
~~~bash
pact-graph-network \
--url https://pact-brocker.your.com/ \
--output report
~~~
View the output in your browser
~~~bash
open report/edge-bundling.html
~~~
### Basic Auth
~~~bash
pact-graph-network --url https://pact-brocker.your.com/ --output report --username $PACT_BROKER_USERNAME --password $PACT_BROKER_PASSWORD
~~~
### Bearer Auth
~~~bash
pact-graph-network --url https://pact-brocker.your.com/ --output report --token $PACT_BROKER_TOKEN
~~~
## Environment Variables
### Options
```
-b, --url Pact broker URL
-u, --username Pact broker username
-p, --password Pact broker password
-t, --token Pact broker token
-o, --output Path of the output dir [default: report]
-g, --graph [default: edge] [possible values: edge, directed]
--timeout timeout of http request in milliseconds [default: 2000]
--exclude list of service to exclude
-h, --help Print help information
-V, --version Print version information
```
### Environment Variables
| Key | Description | Alowed values |
| ---------------------------- | --------------------------------------------- | ------------------------------------- |
| **`PACT_NETWORK_LOG`** | Adds filters to the logger. | `error`,`warn`,`info`,`debug`,`trace` |
| **`PACT_NETWORK_LOG_STYLE`** | Whether or not to print styles to the target. | `auto`, `always`, `never` |
## Feedback
If you have any feedback, please open an issue.
## License
[MIT](https://choosealicense.com/licenses/mit/)