|
25 | 25 | with(delete_local_temp_backup_command)
|
26 | 26 | end
|
27 | 27 |
|
| 28 | + it "restores backups to development with Rubies that do not support Etc.nprocessors" do |
| 29 | + allow(IO).to receive(:read).and_return(database_fixture) |
| 30 | + allow(Kernel).to receive(:system) |
| 31 | + allow(Etc).to receive(:respond_to?).with(:nprocessors).and_return(false) |
| 32 | + |
| 33 | + Parity::Backup.new(from: "production", to: "development").restore |
| 34 | + |
| 35 | + expect(Kernel). |
| 36 | + to have_received(:system). |
| 37 | + with(make_temp_directory_command) |
| 38 | + expect(Kernel). |
| 39 | + to have_received(:system). |
| 40 | + with(download_remote_database_command) |
| 41 | + expect(Kernel). |
| 42 | + to have_received(:system). |
| 43 | + with(drop_development_database_drop_command) |
| 44 | + expect(Kernel). |
| 45 | + to have_received(:system). |
| 46 | + with(restore_from_local_temp_backup_command(cores: 2)) |
| 47 | + expect(Kernel). |
| 48 | + to have_received(:system). |
| 49 | + with(delete_local_temp_backup_command) |
| 50 | + end |
| 51 | + |
28 | 52 | it "restores backups to staging from production" do
|
29 | 53 | stub_heroku_app_name
|
30 | 54 | allow(Kernel).to receive(:system)
|
@@ -101,9 +125,9 @@ def download_remote_database_command
|
101 | 125 | 'curl -o tmp/latest.backup "$(heroku pg:backups:url --remote production)"'
|
102 | 126 | end
|
103 | 127 |
|
104 |
| - def restore_from_local_temp_backup_command |
| 128 | + def restore_from_local_temp_backup_command(cores: number_of_processes) |
105 | 129 | "pg_restore tmp/latest.backup --verbose --clean --no-acl --no-owner "\
|
106 |
| - "--dbname #{default_db_name} --jobs #{number_of_processes} " |
| 130 | + "--dbname #{default_db_name} --jobs #{cores} " |
107 | 131 | end
|
108 | 132 |
|
109 | 133 | def number_of_processes
|
|
0 commit comments