-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow KinD clusters to be deleted or retained
Modifies the KinD Fixture to make it more stable and more flexible. The default behaviour is for the KinD Fixture to delete the KinD cluster only if the KinD cluster existed before the Fixture is started. Similarly, if the KinD Cluster did *not* exist before the Fixture is started, the Fixture deletes the KinD Cluster when it is stopped. This commit adds a WithDeleteOnStop() and WithRetainOnStop() modifier to the KinD Fixture creation allowing users to indicate if they want to change that default behaviour. In addition to the above enhancements, this commit makes our testing more stable by adding some KinD cluster cleanup to our Makefile as well as serializing execution of longer-running, resource-intensive tests. Issue #13 Signed-off-by: Jay Pipes <[email protected]>
- Loading branch information
Showing
9 changed files
with
231 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,44 @@ | ||
VERSION ?= $(shell git describe --tags --always --dirty) | ||
CLUSTERS = $(shell kind get clusters) | ||
|
||
.PHONY: test | ||
|
||
kind-install: | ||
ifeq (, $(shell command -v kind)) | ||
go install sigs.k8s.io/[email protected] | ||
endif | ||
|
||
# We clear the test cache because some of the tests require an out-of-band KinD | ||
# cluster to run against and we want to re-run tests against that KinD cluster | ||
# instead of from cached unit test results. | ||
test: | ||
clear-test-cache: | ||
@echo -n "clearing Go test cache ... " | ||
@go clean -testcache | ||
@go test -v ./... | ||
@echo "ok." | ||
|
||
kind-clear-clusters: | ||
ifeq (, $(shell command -v kind)) | ||
ifneq (, $(CLUSTERS)) | ||
@echo -n "clearing KinD clusters ... " | ||
@for c in $(CLUSTERS); do kind delete cluster -q --name $$c; done | ||
@echo "ok." | ||
endif | ||
endif | ||
|
||
kind-create-cluster: | ||
ifeq (, $(shell command -v kind)) | ||
@echo -n "creating 'kind' cluster ... " | ||
@kind create cluster -q | ||
@echo "ok." | ||
@sleep 5 | ||
endif | ||
|
||
test: clear-test-cache kind-clear-clusters kind-create-cluster test-kind-simple | ||
|
||
test-kind-simple: | ||
@go test -v ./parse_test.go | ||
@go test -v ./eval_test.go | ||
|
||
test-all: test kind-clear-clusters | ||
@go test -v ./fixtures/kind/kind_test.go | ||
@go test -v ./placement_test.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.