Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ jobs:
version: v0.8.1
- name: Docker build
run: |
docker build -t gcr.io/linkerd-io/proxy-init:latest .
docker build -t buoyantio/iptables-tester:v1 -f integration_test/iptables/Dockerfile-tester ./integration_test
make image
make tester-image
- name: Load image into the local KinD cluster
run: |
kind load docker-image gcr.io/linkerd-io/proxy-init:latest
kind load docker-image buoyantio/iptables-tester:v1
run: make kind-load
- name: Run integration tests
run: |
cd integration_test
SKIP_BUILD_TESTER_IMAGE=1 ./run_tests.sh
run: SKIP_BUILD_TESTER_IMAGE=1 make integration-test
4 changes: 1 addition & 3 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ jobs:
# actions/checkout@v2
uses: actions/checkout@722adc6
- name: Format
run: |
gofmt -d .
test -z "$(gofmt -d .)"
run: make fmt
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
# actions/checkout@v2
uses: actions/checkout@722adc6
- name: Run unit tests
run: go test -v ./...
run: make test
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
DOCKER_REGISTRY ?= gcr.io/linkerd-io
REPO = $(DOCKER_REGISTRY)/proxy-init
TESTER_REPO = buoyantio/iptables-tester

.DEFAULT_GOAL := help

.PHONY: help
help: ## Show this help
@echo 'Info: For integration test using KinD, run make kind-load integration-test'
@echo 'Info: For other environments, run make integration-test after having uploaded the images'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loved this technique, I'm gonna steal it 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


###############
# Go
###############
.PHONY: build
build: ## Build the project
go build -o out/linkerd2-proxy-init main.go

.PHONY: run
run: ## Run the project
go run main.go

.PHONY: test
test: ## Perform unit test
go test -v ./...

.PHONY: fmt
fmt: ## Check the code formatting
gofmt -d .
test -z "$(shell gofmt -d .)"

.PHONY: integration-test
integration-test: image ## Perform integration test
cd integration_test && ./run_tests.sh

###############
# Docker
###############
.PHONY: image
image: ## Build docker image for the project
docker build -t $(REPO):latest .

.PHONY: tester-image
tester-image: ## Build docker image for the tester component
docker build -t $(TESTER_REPO):v1 -f ./integration_test/iptables/Dockerfile-tester ./integration_test

.PHONY: kind-load
kind-load: image tester-image ## Load the required image to KinD cluster
kind load docker-image $(REPO):latest
kind load docker-image $(TESTER_REPO):v1
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ Start by building and tagging the `proxy-init` image required for the test:

```bash
eval $(minikube docker-env)
docker build -t gcr.io/linkerd-io/proxy-init:latest .
make image
```

Then run the tests with:

```bash
cd integration_test
./run_tests.sh
make integration-test
```