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

Testing: Shared test task handles db dependencies better #19537

Merged
merged 1 commit into from Jan 5, 2018

Conversation

islemaster
Copy link
Contributor

It's fairly common to try running shared tests in development and have them fail because the pegasus test database hasn't run recent migrations. This makes the shared test task depend on running migrations and incremental seeding for the pegasus test database, which makes it a little slower, but is a few less things devs need to memorize to run shared tests reliably.

It's fairly common to try running shared tests in development and have them fail because the pegasus test database hasn't run recent migrations.  This makes the shared test task depend on running migrations and incremental seeding for the pegasus test database, which makes it a little slower, but is a few less things devs need to memorize to run shared tests reliably.
@islemaster islemaster changed the base branch from staging-next to staging December 11, 2017 18:57
Copy link
Contributor

@wjordan wjordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One tweak to possibly try if you haven't already.

with_rack_env(:test) do
Dir.chdir(pegasus_dir) do
puts 'Migrating pegasus test database...'
RakeUtils.rake 'db:ensure_created', 'db:migrate', 'seed:migrate'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if invoking these Rake tasks from within the existing process (using Rake::Task['db:ensure_created'].invoke rather than RakeUtils.rake) would make this preparation run any quicker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacement you suggested here doesn't work out of the box, because it can't find the db:ensure_created task. I think that's because we're in shared/rake/test.rake but we're trying to run tasks in pegasus/rake/db.rake (hence the directory change). Do you know if there's a clean way to make those pegasus tasks available without exposing them all as part of this rakefile?

@islemaster islemaster merged commit 8e40ac7 into staging Jan 5, 2018
@islemaster islemaster deleted the shared-tests-proactively-migrate branch January 5, 2018 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants