forked from m3dwards/torq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (73 loc) · 2.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
dbContainer = timescale/timescaledb:latest-pg14
testDbPort = 5433
backendTest = go test ./... -v -count=1
frontendTest = cd web && npm i --legacy-peer-deps && npm test -- --watchAll=false
stopDevDb = ($(MAKE) stop-dev-db && false)
#Virtual Network - Frequency(every x seconds; default 1) of creating and paying invoices
virtual_network_invoice_freq = 1
#Virtual Network - Frequency(every x seconds; default 30) of sending coins to random address
virtual_network_send_coins_freq = 30
#Virtual Network - Frequency(every x minutes; default 10) of opening and closing random channels
virtual_network_open_close_chan_freq = 10
lint = cd web && npm i --legacy-peer-deps && npm run lint
.PHONY: test
test: lint start-dev-db wait-db test-backend-with-db-stop test-frontend-with-db-stop stop-dev-db
@echo All tests pass!
.PHONY: test-backend-with-db-stop
test-backend-with-db-stop:
$(backendTest) || $(stopDevDb)
.PHONY: test-frontend-with-db-stop
test-frontend-with-db-stop:
$(frontendTest) || (cd ../ && $(stopDevDb))
.PHONY: test-backend
test-backend:
$(backendTest)
.PHONY: test-frontend
test-frontend:
$(frontendTest)
.PHONY: start-dev-db
start-dev-db:
docker run -d --rm --name testdb -p $(testDbPort):5432 -e POSTGRES_PASSWORD=password $(dbContainer) \
|| $(stopDevDb)
.PHONY: stop-dev-db
stop-dev-db:
docker stop testdb
.PHONY: wait-db
wait-db:
until docker run \
--rm \
--link testdb:pg \
$(dbContainer) pg_isready \
-U postgres \
-h pg; do sleep 1; done
.PHONY: cover
cover:
go test ./... -coverprofile cover.out && go tool cover -html=cover.out
.PHONY: build-docker
build-docker:
docker build . -t $(TAG)
.PHONY: test-e2e
test-e2e:
E2E=true go test -timeout 20m -v -count=1 ./test/e2e/lnd
.PHONY: test-e2e-debug
test-e2e-debug:
E2E=true DEBUG=true go test -timeout 20m -v -count=1 ./test/e2e/lnd
.PHONY: create-dev-env
create-dev-env:
go build ./virtual_network/torq_vn && go run ./virtual_network/torq_vn create --db true
.PHONY: start-dev-env
start-dev-env:
go build ./virtual_network/torq_vn && go run ./virtual_network/torq_vn start --db true
.PHONY: stop-dev-env
stop-dev-env:
go build ./virtual_network/torq_vn && go run ./virtual_network/torq_vn stop --db true
.PHONY: purge-dev-env
purge-dev-env:
go build ./virtual_network/torq_vn && go run ./virtual_network/torq_vn purge --db true
# Start flow
.PHONY: start-dev-flow
start-dev-flow:
go run ./virtual_network/torq_vn flow --virtual_network_invoice_freq $(virtual_network_invoice_freq) --virtual_network_send_coins_freq $(virtual_network_send_coins_freq) --virtual_network_open_close_chan_freq $(virtual_network_open_close_chan_freq)
.PHONY: lint
lint:
$(lint)