summaryrefslogtreecommitdiff
path: root/spec/validators
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/validators
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
downloadgitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/validators')
-rw-r--r--spec/validators/x509_certificate_credentials_validator_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/validators/x509_certificate_credentials_validator_spec.rb b/spec/validators/x509_certificate_credentials_validator_spec.rb
index 9076aee7681..5da1813e379 100644
--- a/spec/validators/x509_certificate_credentials_validator_spec.rb
+++ b/spec/validators/x509_certificate_credentials_validator_spec.rb
@@ -55,6 +55,14 @@ RSpec.describe X509CertificateCredentialsValidator do
expect(record.errors[:private_key]).to include('could not read private key, is the passphrase correct?')
end
+ it 'adds an error when private key does not match certificate' do
+ record.private_key = SSHData::PrivateKey::RSA.generate(4096).openssl.to_pem
+
+ validator.validate(record)
+
+ expect(record.errors[:private_key]).to include('private key does not match certificate.')
+ end
+
it 'has no error when the private key is correct' do
record.private_key = pkey_data
@@ -85,7 +93,7 @@ RSpec.describe X509CertificateCredentialsValidator do
validator.validate(record)
- expect(record.errors[:private_key]).not_to be_empty
+ expect(record.errors[:private_key]).to include('could not read private key, is the passphrase correct?')
end
end
end