diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-04-04 16:06:07 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-04-04 19:35:35 +0200 |
commit | 62521f20e4bfead7b224ea9067be9733fc6e2f90 (patch) | |
tree | 8df484fb82fcdd0bbd4afa6b905ed9918e55dcf4 /spec/tasks | |
parent | 5efd67942cec39d733d27a52edc2ebc86babce30 (diff) | |
download | gitlab-ce-62521f20e4bfead7b224ea9067be9733fc6e2f90.tar.gz |
Add rake task that prints TOML storage configurationfeature/add-rake-task-prints-storage-config-in-toml
Closes gitaly#173
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/gitaly_rake_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index d95baddf546..b369dcbb305 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -75,4 +75,36 @@ describe 'gitlab:gitaly namespace rake task' do end end end + + describe 'storage_config' do + it 'prints storage configuration in a TOML format' do + config = { + 'default' => { 'path' => '/path/to/default' }, + 'nfs_01' => { 'path' => '/path/to/nfs_01' }, + } + allow(Gitlab.config.repositories).to receive(:storages).and_return(config) + + orig_stdout = $stdout + $stdout = StringIO.new + + header = '' + Timecop.freeze do + header = <<~TOML + # Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)} + # This is in TOML format suitable for use in Gitaly's config.toml file. + TOML + run_rake_task('gitlab:gitaly:storage_config') + end + + output = $stdout.string + $stdout = orig_stdout + + expect(output).to include(header) + + parsed_output = TOML.parse(output) + config.each do |name, params| + expect(parsed_output['storage']).to include({ 'name' => name, 'path' => params['path'] }) + end + end + end end |