-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15082 from hennevogel/feature/running_minitest_wi…
…th_docker Introduces ENV['RUNNING_MINITEST_WITH_DOCKER']
- Loading branch information
Showing
4 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace :dev do | ||
namespace :minitest do | ||
namespace :fixtures do | ||
desc 'Create minitest fixtures in the database (as opposed to loading them with db:fixture:load)' | ||
task create: :test_environment do | ||
puts "\n\nMake sure you start with a fresh backend! Outside the container run..." | ||
puts "docker-compose stop backend; docker-compose rm -f backend; docker-compose up -d backend\n\n" | ||
puts 'Please also note this will drop your current test database' | ||
puts "Confirm? Enter 'YES' to confirm:" | ||
input = $stdin.gets.chomp | ||
raise "Aborting... You entered: #{input} not YES" unless input == 'YES' | ||
|
||
Rake::Task['db:drop'].invoke | ||
Rake::Task['db:setup'].invoke | ||
Rake::Task['db:fixtures:load'].invoke | ||
# Enable writing to the backend | ||
CONFIG['global_write_through'] = true | ||
# Login default admin for syncing projects/packages to the backend | ||
User.session = User.get_default_admin | ||
# Rewrite interconnect url | ||
Project.where(remoteurl: 'http://localhost:3200').map { |project| project.update!(remoteurl: 'http://backend:5352') } | ||
# Sync all projects to the backend | ||
Project.all.map(&:store) | ||
# Sync all packages to the backend | ||
# FIXME: Why do we have `_product:fixed-release` in the fixtures if you can't even store it? | ||
Package.where.not(name: '_product:fixed-release').map(&:store) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters