-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Add tests for many directives (#18)
* Test logging and formatting * Add basic_auth tests * Add TestHTTPCircuitBreaker * Add TestHTTPCompression * Add TestHTTPWebsocketTCPConversion * Test cleanup * Add TestDomain * Add metadata tests * Add HTTP Scheme test * Add blank tests * Add remote_addr test to tcp * Add CIDR restictions tests * Update basic tests * Update labels tests * Use testing.Run for test cases * Use require for testing * Use generic test runner. Allows comparing config and then opts post provision * Satisfy linter and make sure blank cidr opts aren't set * Generic ngrok test type for testing main module * Added make file for easier lint and coverage * Correct error log message to indicate unhandled subdirective * Basic auth test fixes. Additional bounds check tests. * Basic auth block empty test * Better basic auth * Name of test * Add help text to makefile, add fmt shortcut * Remove all target from Makefile * Address jsonfield in basic auth * Test branch logic adjustment
- Loading branch information
Showing
15 changed files
with
1,965 additions
and
449 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
cover.out | ||
|
||
Caddyfile | ||
caddy | ||
|
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
GOBIN=$(shell go env GOPATH)/bin | ||
else | ||
GOBIN=$(shell go env GOBIN) | ||
endif | ||
|
||
# Targets | ||
|
||
##@ General | ||
|
||
# The help target prints out all targets with their descriptions organized | ||
# beneath their categories. The categories are represented by '##@' and the | ||
# target descriptions by '##'. The awk commands is responsible for reading the | ||
# entire set of makefiles included in this invocation, looking for lines of the | ||
# file as xyz: ## something, and then pretty-format the target and help. Then, | ||
# if there's a line with ##@ something, that gets pretty-printed as a category. | ||
# More info on the usage of ANSI control characters for terminal formatting: | ||
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters | ||
# More info on the awk command: | ||
# http://linuxcommand.org/lc3_adv_awk.php | ||
|
||
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
|
||
.PHONY: fmt | ||
fmt: ## Run go fmt against code. | ||
go fmt ./... | ||
|
||
.PHONY: lint | ||
lint: fmt ## Run the linter | ||
golangci-lint run . | ||
|
||
.PHONY: test | ||
test: fmt ## Run tests. | ||
go test -coverprofile cover.out ./... | ||
|
||
.PHONY: coverage | ||
coverage: test ## Run tests and Load coverage report | ||
go tool cover -html cover.out |
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
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.