Skip to content
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

Persist emulator in test-suite, pause containers #263

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif


dev = docker-compose -f docker-compose.dev.yml -p flow-wallet-api-dev
test = docker-compose -f docker-compose.test-suite.yml -p flow-wallet-api-test
test-suite = docker-compose -f docker-compose.test-suite.yml -p flow-wallet-api-test

.PHONY: dev
dev:
Expand Down Expand Up @@ -64,17 +64,19 @@ lint:

.PHONY: run-test-suite
run-test-suite:
@$(test) build flow api
@$(test) up --remove-orphans -d db redis flow
@echo "\nRunning tests, hang on...\n" \
; $(test) run --rm api go test ./... -p 1 \
@$(test-suite) build flow api
@$(test-suite) up --remove-orphans -d db redis flow
@$(test-suite) unpause \
; echo "\nRunning tests, hang on...\n" \
; $(test-suite) run --rm api go test ./... -p 1 \
; echo "\nRunning linter, hang on...\n" \
; $(test) run --rm lint golangci-lint run
; $(test-suite) run --rm lint golangci-lint run \
; $(test-suite) pause

.PHONY: stop-test-suite
stop-test-suite:
@$(test) down --remove-orphans
@$(test-suite) down --remove-orphans

.PHONY: clean-test-suite
clean-test-suite:
@$(test) run --rm api go clean -testcache
@$(test-suite) run --rm api go clean -testcache
4 changes: 2 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
ports:
- "3569:3569"
volumes:
- emulator_persist:/flowdb
- emulator-persist:/flowdb
env_file:
- ./.env
environment:
Expand Down Expand Up @@ -67,6 +67,6 @@ services:
- redis

volumes:
emulator_persist:
emulator-persist:
go-modules:
go-cache:
5 changes: 4 additions & 1 deletion docker-compose.test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ services:
entrypoint: ["/bin/sh","-c"]
command:
- |
flow emulator -b 100ms &
flow emulator -b 100ms --persist &
sleep 1
flow project deploy --network=emulator --update=true
tail -F anything
environment:
FLOW_SERVICEPRIVATEKEY: 91a22fbd87392b019fbe332c32695c14cf2ba5b6521476a8540228bdf1987068
FLOW_SERVICEKEYSIGALGO: ECDSA_P256
FLOW_SERVICEKEYHASHALGO: SHA3_256
FLOW_DBPATH: /flowdb
working_dir: /flow
volumes:
- "./flow:/flow:ro"
- emulator-persist:/flowdb

api:
build:
Expand Down Expand Up @@ -73,5 +75,6 @@ services:
- go-cache:/root/.cache/go-build

volumes:
emulator-persist:
go-modules:
go-cache: