summaryrefslogtreecommitdiff
path: root/spec/tasks/gitlab/backup_rake_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-12-01 03:39:31 +0000
committerDouwe Maan <douwe@gitlab.com>2016-12-01 03:39:31 +0000
commit7633e4ae3f99aa109788b90a722a2404f6e3536d (patch)
tree6ec31f1fa6e08dbebfa632a431294498415a61c2 /spec/tasks/gitlab/backup_rake_spec.rb
parent01363afe50e050d8b1d30b7d215cbf2b4a7b6b23 (diff)
parent0fbb5a86dbe054af91c20d36697fda273445dd2a (diff)
downloadgitlab-ce-7633e4ae3f99aa109788b90a722a2404f6e3536d.tar.gz
Merge branch '23718/backup-rake-task-human-readable' into 'master'
23718/backup rake task human readable ## What does this MR do? Add the human readable format to the backup tar file. From `1477317140_gitlab_backup.tar` to `1477317140_2016_10_24_gitlab_backup.tar`. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? #23718 issue ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? 23718 See merge request !7188
Diffstat (limited to 'spec/tasks/gitlab/backup_rake_spec.rb')
-rw-r--r--spec/tasks/gitlab/backup_rake_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb
index ecbfc236d3d..a9fea5f1e81 100644
--- a/spec/tasks/gitlab/backup_rake_spec.rb
+++ b/spec/tasks/gitlab/backup_rake_spec.rb
@@ -333,4 +333,35 @@ describe 'gitlab:app namespace rake task' do
expect { run_rake_task('gitlab:backup:restore') }.not_to raise_error
end
end
+
+ describe "Human Readable Backup Name" do
+ def tars_glob
+ Dir.glob(File.join(Gitlab.config.backup.path, '*_gitlab_backup.tar'))
+ end
+
+ before :all do
+ @origin_cd = Dir.pwd
+
+ reenable_backup_sub_tasks
+
+ FileUtils.rm tars_glob
+
+ # Redirect STDOUT and run the rake task
+ orig_stdout = $stdout
+ $stdout = StringIO.new
+ run_rake_task('gitlab:backup:create')
+ $stdout = orig_stdout
+
+ @backup_tar = tars_glob.first
+ end
+
+ after :all do
+ FileUtils.rm(@backup_tar)
+ Dir.chdir @origin_cd
+ end
+
+ it 'name has human readable time' do
+ expect(@backup_tar).to match(/\d+_\d{4}_\d{2}_\d{2}_gitlab_backup.tar$/)
+ end
+ end
end # gitlab:app namespace