Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 2.42 KB

CONTRIBUTING.md

File metadata and controls

64 lines (44 loc) · 2.42 KB

Contributing Code or Documentation

To work on this project, you need a Kubernetes cluster accessible via kubectl. It can be a local cluster based on Minikube, Docker Desktop for Mac, or even a remote cluster hosted on AWS / GCP / Azure / etc.

Setting up the environment

There is a script that will take care to create the required resources used in the tests (services, config maps, secrets, etc):

./setup-kubernetes.sh

Running all the tests

The test suite is composed of:

  • Few unit tests.
  • Some integration tests that spin a local Micronaut instance, grab a bean from the context, invoke methods and make assertions. Those use either @MicronautTest or ApplicationContext.run().
  • Some functional tests that exercise the sample applications deployed in Kubernetes. They are all the tests located inside examples/micronaut-service and examples/micronaut-client.

To run all the tests, simply execute:

./gradlew test

Sample applications

The test infrastructure is composed of 2 sample applications that will be deployed to Kubernetes:

  • example-service: contains some endpoints to check distributed configuration. There are 2 replicas of it (for load-balancing testing purposes). It is accessible locally at the following ports:

    • 9999 and 9998 to access the application for each of the replicas.
    • 5004 to attach a remote debugger.
  • example-client: it acts as a service discovery client for example-service. It is accessible locally at the following ports:

    • 8888 to access the application.
    • 5005 to attach a remote debugger.

If you make changes (adding endpoints and/or tests) to any of them, you need to execute setup-kubernetes.sh again to have the Docker images built and redeployed to Kubernetes.

Tearing down the environment

All the resources will be created on its own Kubernetes namespace (micronaut-kubernetes), which you can destroy afterwards to keep your cluster clean. Alternatively, you can run:

./cleanup-kubernetes.sh

Checkstyle

Be aware that this project uses Checkstyle, and your PR might fail in Travis if you do not pay attention to any potential Checkstyle warnings. Make sure you run Checkstyle for your branch before submitting any PR:

./gradlew checkstyleMain