Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-16 12:10:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-16 12:10:45 +0300
commit554bb1eb1f1aa5aa45b5e4a1ee1557da0ccc59c0 (patch)
tree29a8009abef0ac5ecce6b8b608d5af2381a9663f /spec
parent3e4c70d0708bdbf27edf4bbd3f01b85a921f759e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/pages/url_builder_spec.rb8
-rw-r--r--spec/models/pages/lookup_path_spec.rb10
-rw-r--r--spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb24
3 files changed, 41 insertions, 1 deletions
diff --git a/spec/lib/gitlab/pages/url_builder_spec.rb b/spec/lib/gitlab/pages/url_builder_spec.rb
index 9b6ecffa426..1a97ca01c3e 100644
--- a/spec/lib/gitlab/pages/url_builder_spec.rb
+++ b/spec/lib/gitlab/pages/url_builder_spec.rb
@@ -177,7 +177,7 @@ RSpec.describe Gitlab::Pages::UrlBuilder, feature_category: :pages do
context 'when pages_unique_domain_enabled is true' do
let(:unique_domain_enabled) { true }
- it { is_expected.to eq('http://unique-domain.example.com') }
+ it { is_expected.to eq('http://example.com/unique-domain') }
end
end
end
@@ -192,6 +192,12 @@ RSpec.describe Gitlab::Pages::UrlBuilder, feature_category: :pages do
it { is_expected.to be_nil }
end
+ context 'when namespace_in_path is true' do
+ let(:namespace_in_path) { true }
+
+ it { is_expected.to be_nil }
+ end
+
context 'when pages_unique_domain_enabled is true' do
let(:unique_domain_enabled) { true }
diff --git a/spec/models/pages/lookup_path_spec.rb b/spec/models/pages/lookup_path_spec.rb
index aa92a5d028c..ccca6e7a48a 100644
--- a/spec/models/pages/lookup_path_spec.rb
+++ b/spec/models/pages/lookup_path_spec.rb
@@ -134,6 +134,16 @@ RSpec.describe Pages::LookupPath, feature_category: :pages do
end
end
+ context 'when namespace_in_path is enabled' do
+ before do
+ stub_pages_setting(namespace_in_path: true)
+ end
+
+ it 'returns nil' do
+ expect(lookup_path.unique_host).to be_nil
+ end
+ end
+
context 'when unique domain is enabled' do
it 'returns the project unique domain' do
project.project_setting.pages_unique_domain_enabled = true
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