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

Create a dedicated DB for testing prod-migrations #1945

Merged
merged 3 commits into from Apr 2, 2019

Conversation

2 participants
@chrisgilmerproj
Copy link
Contributor

chrisgilmerproj commented Apr 1, 2019

Description

Adding the role ecs_user to the DB via a migration broke the ability to run multiple migrations against the same postgres container. This change creates a dedicated container for testing prod-migrations. This should give us even more confidence that the migrations are not being affected by the dev-db migrations.

The new DB runs in a container on port 5434. Everyone will need to update their SQL Editor to use that port if they want to connect.

With this abstraction we should be able to make run-prod-migrations a step in the CircleCI workflow, meaning we wouldn't have to rely on manual testing to ensure things pass.

Setup

direnv allow
run-prod-migrations

Code Review Verification Steps

  • Request review from a member of a different team.
  • Have the Pivotal acceptance criteria been met for this change?

References

@chrisgilmerproj chrisgilmerproj self-assigned this Apr 1, 2019

@chrisgilmerproj chrisgilmerproj marked this pull request as ready for review Apr 1, 2019

@codecov

This comment has been minimized.

Copy link

codecov bot commented Apr 1, 2019

Codecov Report

Merging #1945 into master will decrease coverage by 0.22%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1945      +/-   ##
==========================================
- Coverage   60.51%   60.29%   -0.22%     
==========================================
  Files         193      192       -1     
  Lines       12245    12143     -102     
==========================================
- Hits         7409     7321      -88     
+ Misses       3968     3961       -7     
+ Partials      868      861       -7
@reggieriser
Copy link
Contributor

reggieriser left a comment

Ran run-prod-migrations and this seemed to work for me. Was able to see the database/data at port 5434.

I added a couple of comments about some duplication in settings that I noticed, but those might be OK/expected since I haven't dug through the build infrastructure in detail.

export DB_PORT_TEST=5433
export DB_NAME=dev_db
export DB_NAME_DEV=dev_db

This comment has been minimized.

Copy link
@reggieriser

reggieriser Apr 2, 2019

Contributor

Do we need both DB_NAME and DB_NAME_DEV since they are set to the same thing? Or should one be set to the other?

This comment has been minimized.

Copy link
@chrisgilmerproj

chrisgilmerproj Apr 2, 2019

Author Contributor

No, we don't, but I was being a completionist so I just added it in as a nice-to-have.

@@ -1,7 +1,9 @@
NAME = ppp
DB_NAME_DEV = dev_db
DB_NAME_PROD_MIGRATIONS = prod_migrations

This comment has been minimized.

Copy link
@reggieriser

reggieriser Apr 2, 2019

Contributor

These aren't pulled in from what's in the .envrc file?

This comment has been minimized.

Copy link
@chrisgilmerproj

chrisgilmerproj Apr 2, 2019

Author Contributor

They are pulled in. There's some historical reason for it but it's probably to do with CircleCI not running direnv allow. That's my guess.

@chrisgilmerproj chrisgilmerproj merged commit 9cf57e9 into master Apr 2, 2019

18 of 19 checks passed

codecov/project/go 60.11% (-0.22%) compared to 5b5e3ec
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
ci/circleci: acceptance_tests_experimental Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_local Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_staging Your tests passed on CircleCI!
Details
ci/circleci: build_app Your tests passed on CircleCI!
Details
ci/circleci: build_migrations Your tests passed on CircleCI!
Details
ci/circleci: build_tools Your tests passed on CircleCI!
Details
ci/circleci: client_test Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_api Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_mymove Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_office Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_tsp Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_golang Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_yarn Your tests passed on CircleCI!
Details
ci/circleci: pre_test Your tests passed on CircleCI!
Details
ci/circleci: server_test Your tests passed on CircleCI!
Details
ci/circleci: server_test_coverage Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected when comparing 5b5e3ec...70198a2
Details

@chrisgilmerproj chrisgilmerproj deleted the cg_164936406_prod_migrations_dedicated_db branch Apr 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.