Integration Testing

make k8s-integration-tests

or one by one using the test name. For example, to trigger TestExec, run:

make k8s-integration-TestExec-test

Helpful Logging tools

In the course of developing NSM, you will often find yourself wanting to look at logs for various NSM components.

The following:

make k8s-nsmd-logs

will dump all the logs for all running nsmd Pods in the cluster (you are going to want to redirect these to a file).

This works for any component in the system.

Regenerating code

If you change types.go or any of the .proto files you will need to be able to run go generate ./... to regenerate the code.

For rerunning the code generation the required dependencies are retrieved with the script:


To regenerate code:

go generate ./...

NOTE: The script scripts/ will download a released version of protoc, however, at the time of this writing there are no protoc releases built with the grpc plugin functionality made use of by the networkservicemesh project. Specifically, the UnimplementedServer* method generation is missing.

Updating Deps

If you need to add new dependencies, run:

go mod tidy


As part of our CI, we run shellcheck on all shell scripts in the repo. If you want to run it locally, you need to install shellcheck

Canonical source on how to build

The .circleci/config.yml file is the canonical source of how to build Network Service Mesh in case this file becomes out of date.

Code formatting

We use goimports tool since it formats the code in the same style as go fmt and organizes imports additionally.

To install it run:

make install-formatter

To do formatting run:

make format

It may be useful to have goimports -w -local installed as on save hook in your editor. Go imports doc page may help you to achieve this.

Static analysis of code

Get code static analyzer tool:

make lint-install

Make sure that tools is installed and can be used from terminal:

golangci-lint --version

If the command above doesn’t work make sure the tool exists in go/bin directory.

Checking changes:

make lint-check-diff

Checking changes with memory limitation:

GOGC=30 make lint-check-diff

Checking all code in the project:

make lint-check-all

If you have any unsolvable problem with a concrete linter then consider updating .golanci.yaml