Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 1.92 KB

how-to-create-a-microservice.md

File metadata and controls

87 lines (60 loc) · 1.92 KB

How to create a new microservice

NOTE: In the below examples we will be creating a service called football.

Create your protos

Create new .proto files under /api following this doc.

Generate the code using hammer

To decide which service to create read the docs here.

Rework generated code as needed

The code generated by hammer has a bunch of TODO comments that need to be resolved. You need to resolve those.

Tests

Write your unit tests along side your service code.

Write your integration tests under a new directory test/integration/football.

For functional tests you can do either OR both of the below:

  1. Write your functional tests under a new directory test/functional/football
  2. Use an existing functional test under test/functional

Update the values.yaml and azure-pipelines.yml to enable/disable the integration and/or functional tests you need for this new service:

# Example of service with NO integration tests and TWO functional tests

# file: internal/football/values.yaml

...

rollout:
  testing:
    integration:
      isEnabled: false
    functional:
      isEnabled: true
      tests:
        - football
        - soccer

...

# file: internal/football/azure-pipelines.yml

parameters:
  - name: serviceName
    type: string
    default: football
  - name: integrationTests
    type: object
    default: {}
  - name: functionalTests
    type: object
    default:
      - football
      - soccer

trigger:
  branches:
    include:
      - main
  paths:
    include:
      - deployments
      - internal/football
      - pkg
      - test/functional/shared-scripts
      - test/functional/football
      - test/functional/soccer

...

Validate the service functionality

Test in your own namespace using the Makefile targets here.

Open a PR

Open your PR to main following the PR guidelines here.