This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
forked from pedroMMM/refinery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (50 loc) · 1.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.PHONY: test
#: run all tests
test: test_with_race test_all
.PHONY: test_with_race
#: run only tests tagged with potential race conditions
test_with_race: wait_for_redis
@echo
@echo "+++ testing - race conditions?"
@echo
go test -tags race --race --timeout 60s -v ./...
.PHONY: test_all
#: run all tests, but with no race condition detection
test_all: wait_for_redis
@echo
@echo "+++ testing - all the tests"
@echo
go test -tags all --timeout 60s -v ./...
.PHONY: wait_for_redis
# wait for Redis to become available for test suite
wait_for_redis: dockerize
@echo
@echo "+++ We need a Redis running to run the tests."
@echo
@echo "Checking with dockerize $(shell ./dockerize --version)"
@./dockerize -wait tcp://localhost:6379 -timeout 30s
# ensure the dockerize command is available
dockerize: dockerize.tar.gz
tar xzvmf dockerize.tar.gz
HOST_OS := $(shell uname -s | tr A-Z a-z)
# You can override this version from an environment variable.
DOCKERIZE_VERSION ?= v0.6.1
DOCKERIZE_RELEASE_ASSET := dockerize-${HOST_OS}-amd64-${DOCKERIZE_VERSION}.tar.gz
dockerize.tar.gz:
@echo
@echo "+++ Retrieving dockerize tool for Redis readiness check."
@echo
# make sure that file is available
sudo apt-get update
sudo apt-get -y install file
curl --location --silent --show-error \
--output dockerize.tar.gz \
https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/${DOCKERIZE_RELEASE_ASSET} \
&& file dockerize.tar.gz | grep --silent gzip
.PHONY: clean
clean:
rm -f dockerize.tar.gz
rm -f dockerize