-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Makefile changes #120
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,9 @@ GOMOD=$(GOCMD) mod | |
GOFMT=$(GOCMD) fmt | ||
GODOC=godoc | ||
|
||
.PHONY: all test coverage | ||
.PHONY: all test coverage get checkfmt fmt godoc \ | ||
examples godoc_examples start-redis stop-redis monitor | ||
|
||
all: test coverage examples | ||
|
||
get: | ||
|
@@ -19,7 +21,18 @@ get: | |
TLS_CERT ?= redis.crt | ||
TLS_KEY ?= redis.key | ||
TLS_CACERT ?= ca.crt | ||
REDISEARCH_TEST_HOST ?= 127.0.0.1:6379 | ||
|
||
REDIS_SERVER ?= localhost:6379 | ||
export REDISEARCH_TEST_HOST=$(REDIS_SERVER) | ||
|
||
REDIS_HOST:=$(word 1,$(subst :, ,$(REDIS_SERVER))) | ||
REDIS_PORT:=$(word 2,$(subst :, ,$(REDIS_SERVER))) | ||
ifeq ($(word 1,$(REDIS_HOST)),) | ||
REDIS_HOST:=localhost | ||
endif | ||
ifeq ($(word 1,$(REDIS_PORT)),) | ||
REDIS_PORT:=6379 | ||
endif | ||
|
||
checkfmt: | ||
@echo 'Checking gofmt';\ | ||
|
@@ -41,16 +54,21 @@ examples: get | |
./redisearch_tls_client --tls-cert-file $(TLS_CERT) \ | ||
--tls-key-file $(TLS_KEY) \ | ||
--tls-ca-cert-file $(TLS_CACERT) \ | ||
--host $(REDISEARCH_TEST_HOST) | ||
--host $(REDIS_SERVER) | ||
|
||
fmt: | ||
$(GOFMT) ./... | ||
|
||
godoc_examples: get fmt | ||
$(GOTEST) -race -covermode=atomic ./redisearch | ||
|
||
TEST ?= Test | ||
ifeq ($(VERBOSE),1) | ||
TEST_FLAGS += -v | ||
endif | ||
|
||
test: get fmt | ||
$(GOTEST) -run "Test" ./redisearch | ||
$(GOTEST) $(TEST_FLAGS) -run $(TEST) ./redisearch | ||
|
||
coverage: get | ||
$(GOTEST) -race -coverprofile=coverage.txt -covermode=atomic ./redisearch | ||
|
@@ -60,3 +78,11 @@ godoc: | |
echo "Open browser tab on localhost:6060" | ||
$(GODOC) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if possible can we take this chance to also add the microbenchamrks rule @rafie ? |
||
start-redis: | ||
@docker run --name redisearch-go-tests -d --rm -p 6379:6379 redislabs/redisearch:edge | ||
|
||
stop-redis: | ||
@docker stop redisearch-go-tests | ||
|
||
monitor: | ||
@redis-cli -h $(REDIS_HOST) -p $(REDIS_PORT) monitor |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ type Game struct { | |
Categories []string `json:"categories"` | ||
} | ||
|
||
func init() { | ||
func _init() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. U1000: func _init is unused There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deadcode: |
||
/* load test data */ | ||
value, exists := os.LookupEnv("REDISEARCH_RDB_LOADED") | ||
requiresDatagen := true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add
-count=1
to TEST_FLAGS to ensure multiple calls to test do indeed trigger the tests.