Skip to content

Commit

Permalink
Fix running of server test coverage to match server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gilmer committed Oct 9, 2019
1 parent 7e51a49 commit 3099af9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ jobs:
- restore_cache:
keys:
- go-mod-sources-v2-{{ checksum "go.sum" }}
- run: echo 'export PATH=${PATH}:~/go/bin:~/transcom/mymove/bin' >> $BASH_ENV
- run:
name: Build Go Junit Report
command: make bin/go-junit-report
- run: echo 'export PATH=${PATH}:~/go/bin:~/transcom/mymove/bin' >> $BASH_ENV
- run: make bin/milmove
- run: make db_test_reset
- run: make db_test_migrate
Expand Down Expand Up @@ -425,7 +425,7 @@ jobs:

# `server_test_coverage` runs code coverage and submits it to CodeClimate
server_test_coverage:
executor: mymove_and_postgres_medium
executor: mymove_and_postgres_large
steps:
- checkout
- setup_remote_docker:
Expand All @@ -441,19 +441,23 @@ jobs:
curl -L --retry 5 --retry-connrefused https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 --output /home/circleci/cc-test-reporter
chmod +x /home/circleci/cc-test-reporter
/home/circleci/cc-test-reporter before-build -d
- run: make bin/milmove
- run: make db_test_reset
- run: make db_test_migrate
- run:
name: make server_test_coverage_generate
name: make server_test_coverage_generate_standalone
command: |
echo 'export LOGIN_GOV_SECRET_KEY=$(echo $E2E_LOGIN_GOV_SECRET_KEY | base64 --decode)' >> $BASH_ENV
source $BASH_ENV
make server_test_coverage_generate
make server_test_coverage_generate_standalone
environment:
DB_PASSWORD: mysecretpassword
DB_USER: postgres
DB_HOST: localhost
DB_PORT_TEST: 5433
DB_PORT: 5432
DB_NAME: test_db
DB_NAME_TEST: test_db
EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16
ENV: test
ENVIRONMENT: test
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,9 @@ server_test_all: db_dev_reset db_dev_migrate ## Run all server unit tests
DB_PORT=$(DB_PORT_TEST) go test -parallel 4 -count 1 $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/ | grep -v mocks)

.PHONY: server_test_coverage_generate
server_test_coverage_generate: db_test_reset db_test_migrate ## Run server unit test coverage
server_test_coverage_generate: db_test_reset db_test_migrate server_test_coverage_generate_standalone ## Run server unit test coverage

.PHONY: server_test_coverage_generate_standalone
# Don't run tests in /cmd or /pkg/gen
# Use -test.parallel 1 to test packages serially and avoid database collisions
# Disable test caching with `-count 1` - caching was masking local test failures
Expand Down Expand Up @@ -548,7 +550,6 @@ endif
db_test_start: ## Start Test DB
ifndef CIRCLECI
brew services stop postgresql 2> /dev/null || true
endif
@echo "Starting the ${DB_DOCKER_CONTAINER_TEST} docker database container..."
docker start $(DB_DOCKER_CONTAINER_TEST) || \
docker run --name $(DB_DOCKER_CONTAINER_TEST) \
Expand All @@ -559,6 +560,9 @@ endif
$(DB_DOCKER_CONTAINER_IMAGE)\
-c fsync=off\
-c full_page_writes=off
else
@echo "Relying on CircleCI's database setup to start the DB."
endif

.PHONY: db_test_create
db_test_create: ## Create Test DB
Expand Down

0 comments on commit 3099af9

Please sign in to comment.