summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-07 15:07:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-07 15:07:34 +0000
commitb4028d450087e97f26d4baa23e08396bcbabe3e0 (patch)
treef84a5cbb29e43bab0ba58db1bc5619112c8c482e /spec/migrations
parent05f1d5d9813332bdd456cb358517e56168a24224 (diff)
downloadgitlab-ce-b4028d450087e97f26d4baa23e08396bcbabe3e0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/update_fingerprint_sha256_within_keys_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb b/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb
new file mode 100644
index 00000000000..bdb661af904
--- /dev/null
+++ b/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+require Rails.root.join('db', 'post_migrate', '20200106071113_update_fingerprint_sha256_within_keys.rb')
+
+describe UpdateFingerprintSha256WithinKeys, :sidekiq, :migration do
+ let(:key_table) { table(:keys) }
+
+ describe '#up' do
+ it 'the BackgroundMigrationWorker will be triggered and fingerprint_sha256 populated' do
+ key_table.create!(
+ id: 1,
+ user_id: 1,
+ title: 'test',
+ key: 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt1016k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=',
+ fingerprint: 'ba:81:59:68:d7:6c:cd:02:02:bf:6a:9b:55:4e:af:d1',
+ fingerprint_sha256: nil
+ )
+
+ expect(Key.first.fingerprint_sha256).to eq(nil)
+
+ described_class.new.up
+
+ expect(BackgroundMigrationWorker.jobs.size).to eq(1)
+ expect(BackgroundMigrationWorker.jobs.first["args"][0]).to eq("MigrateFingerprintSha256WithinKeys")
+ expect(BackgroundMigrationWorker.jobs.first["args"][1]).to eq([1, 1])
+ end
+ end
+end