User segmentation is to differentiate how the system treat users based on parameters associated to their segments.
This project is based on clean architecture template by Ardalis
- A user is identified by his username and therefore it must unique.
- A segment is identified by it's name and therefore it must unique.
- When a user is created, he must be assigned to a default segment.
- A segment is considered a default one if it's name is equal to "default".
- Only one default segment can exist.
- The default segment is created at application startup.
You can find acceptance tests project under tests folder. They are written in English using Gherkin language and run by Specflow runner.
When tests are run, an instance of the application will spin up configured with sql-lite database and the migrations will be automatically executed. You can find the configuration code in ApplicationFactory class.
First install Specflow plugin in your favorite IDE (They support both Visual studio and Rider)
Build acceptance tests project and then go the feature you want to run and hit the run button just like this
or simply go to test explorer and run all tests.
First, go to Web project under src folder and build the docker image
docker build -t user-segmentation:1.0.0 .
Go to k8s directory under root folder and create development namespace
kubectl create namespace development
then create application and database instances along with other manifests simply by running
kubectl apply -f .
To check the app is up and running you can port-forwarding the application service
kubectl port-forward -n development svc/user-segmentation 8080:8080
and open Swagger in your browser.
The following image represents different manifests used in the deployment