diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 00:07:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 00:07:45 +0300 |
commit | 0b12a5312c9701fbfed25fbb334d47900ced736b (patch) | |
tree | a29a27e297134f573fd8e5c298d241f3156c207a /spec/lib/gitlab/background_migration | |
parent | 92f95ccac81911d1fcc32e999a7f1ce04624a56c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/background_migration')
-rw-r--r-- | spec/lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys_spec.rb b/spec/lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys_spec.rb index 3101e782b8f..3ccb2379936 100644 --- a/spec/lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys_spec.rb +++ b/spec/lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys_spec.rb @@ -37,6 +37,25 @@ describe Gitlab::BackgroundMigration::MigrateFingerprintSha256WithinKeys, :migra expect(key_2.fingerprint_sha256).to eq('zMNbLekgdjtcgDv8VSC0z5lpdACMG3Q4PUoIz5+H2jM') end + context 'with invalid keys' do + before do + key = Key.find(1017) + # double space after "ssh-rsa" leads to a + # OpenSSL::PKey::PKeyError in Net::SSH::KeyFactory.load_data_public_key + key.update_column(:key, key.key.gsub('ssh-rsa ', 'ssh-rsa ')) + end + + it 'ignores errors and does not set the fingerprint' do + fingerprint_migrator.perform(1, 10000) + + key_1 = Key.find(1017) + key_2 = Key.find(1027) + + expect(key_1.fingerprint_sha256).to be_nil + expect(key_2.fingerprint_sha256).not_to be_nil + end + end + it 'migrates all keys' do expect(Key.where(fingerprint_sha256: nil).count).to eq(Key.all.count) |