diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-16 12:10:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-16 12:10:45 +0300 |
commit | 554bb1eb1f1aa5aa45b5e4a1ee1557da0ccc59c0 (patch) | |
tree | 29a8009abef0ac5ecce6b8b608d5af2381a9663f /spec/services | |
parent | 3e4c70d0708bdbf27edf4bbd3f01b85a921f759e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb b/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb index 0e46391c0ad..63b5d54a18d 100644 --- a/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb +++ b/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb @@ -188,4 +188,28 @@ RSpec.describe PagesDomains::ObtainLetsEncryptCertificateService, feature_catego service.execute end end + + context 'when the domain URL is longer than 64 characters' do + let(:long_domain) { "a.b.c.#{'d' * 63}" } + let(:pages_domain) { create(:pages_domain, :without_certificate, :without_key, domain: long_domain) } + let(:service) { described_class.new(pages_domain) } + + it 'logs an error and does not proceed with certificate acquisition' do + expect(Gitlab::AppLogger).to receive(:error).with( + hash_including( + message: "Domain name too long for Let's Encrypt certificate", + pages_domain: long_domain, + pages_domain_bytesize: long_domain.bytesize, + max_allowed_bytesize: described_class::MAX_DOMAIN_LENGTH, + project_id: pages_domain.project_id + ) + ) + + # Ensure that the certificate acquisition is not attempted + expect(::PagesDomains::CreateAcmeOrderService).not_to receive(:new) + expect(PagesDomainSslRenewalWorker).not_to receive(:perform_in) + + service.execute + end + end end |