Introduction to Micro-Test-Hub
Micro-Test-Hub is a versatile CLI tool designed to facilitate debugging and the creation of integration tests for systems built on the microservices architecture. It offers robust support for testing various types of services, categorized as follows:
-
Application Services:
- Container-Based Services
- Function-Based Services
-
Cloud Services:
- GCP Firestore
- GCP Pub/Sub
- GCP Storage
-
Databases:
- PostgreSQL
Micro-Test-Hub is designed with cross-platform compatibility in mind, making it adaptable to various environments where services may be deployed. Currently, the tool supports Docker Compose, with plans to extend support to additional platforms, including:
- GCP Platform
- Amazon Platform
- Minikube
To get started with Micro-Test-Hub, simply install the CLI tool using the following command:
pip install micro-test-hub
Run your first integration tests
You can start using Micro-Test-Hub by running the sample project, which includes basic integration tests for the moc system. Follow these steps:
GCP Artifacts Registry authentication
To authenticate with Google Cloud Platform's Artifact Registry, follow these steps:
-
Install the Google Cloud SDK: If you haven't already, download and install the Google Cloud SDK from https://cloud.google.com/sdk/docs/install.
-
Authenticate your Google Cloud account: Run the following command and follow the on-screen instructions to log in with your Google account:
gcloud auth login
-
Configure artifacts registry for region:
gcloud auth configure-docker europe-west1-docker.pkg.dev
Install micro-test-hub
-
Install micro-test-hub:
pip install micro-test-hub
-
Copy the moc_integration_tests folder from repo to your local machine:
-
change directory to the moc_integration_tests:
cd moc_integration_tests
-
copy your application_default_credentials.json to moc_integration_tests/credentials folder
cp -f ~/.config/gcloud/application_default_credentials.json ./credentials
-
copy the ouput of the following command and add it to gateway_sfm_sm_postgress.microhub file (line 13)
export gcloud_id_token=$(gcloud auth print-identity-token) && echo $gcloud_id_token
Run micro-test-hub
- Detached mode (default)
micro-test-hub run-test
- Attached mode
micro-test-hub run-test --mode attached
Build Your Own Project from Scratch
With Micro-Test-Hub, you can create your own project from scratch, defining the services, their types, and the dependencies they require. You can also specify a path for your Python tests, which must have main.py as the entry point module. Here’s a summary of the dependencies you need to define for each type of service:
-
Container/Docker Service:
image_urienvironment vars
-
Function Service:
code repoenvironment vars
-
GCP Service:
- The type of service (Firestore, Pub/Sub, Storage)
-
Database:
- The initialization SQL file
You can start by using the help command to see the supported commands:
micro-test-hub --help
Metadata
Release files for micro-test-hub 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| micro_test_hub-0.1.10.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| micro_test_hub-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.5 kB
Release files / micro_test_hub-0.1.10.tar.gz
| Download URL | micro_test_hub-0.1.10.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc9300347937e5abf32e306c104b74efe224989e7cfc676f1360e6ac243564d2
|
|
BLAKE2b-256 checksum How to use checksums |
93f956c7055719a1da78a88181e7ff700f855c00f5ba2604f36890b158e7ba36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / micro_test_hub-0.1.10-py3-none-any.whl
| Download URL | micro_test_hub-0.1.10-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74d621b67b229785cea21b1f1abf07cd6155a30a7e6329b5b395ff9c0c4d6f47
|
|
BLAKE2b-256 checksum How to use checksums |
f13ca4eb510c8fcaab0b095e5e00bbbf5c85ee36f896ea3400be3c191ffd619d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|