diff options
author | Krasimir Angelov <kangelov@gitlab.com> | 2019-09-06 17:20:05 +1200 |
---|---|---|
committer | Krasimir Angelov <kangelov@gitlab.com> | 2019-09-10 13:56:07 +1200 |
commit | 676675dc0b95194be72dfa13829b5ba06e0d1844 (patch) | |
tree | 21a2227c9ea34b715016456ef37e2f0b4eed5df2 /spec/requests/api/internal | |
parent | 8ce331c206dd97bbfc672a554afb8bc0f8039983 (diff) | |
download | gitlab-ce-676675dc0b95194be72dfa13829b5ba06e0d1844.tar.gz |
Add support for custom domains to the internal Pages API
Update the `/internal/pages` endpoint to return virtual domain
configuration for custom domains.
Diffstat (limited to 'spec/requests/api/internal')
-rw-r--r-- | spec/requests/api/internal/pages_spec.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/requests/api/internal/pages_spec.rb b/spec/requests/api/internal/pages_spec.rb index 0b3c5be9c45..e1b563b92f4 100644 --- a/spec/requests/api/internal/pages_spec.rb +++ b/spec/requests/api/internal/pages_spec.rb @@ -43,10 +43,32 @@ describe API::Internal::Pages do super(host, headers) end - it 'responds with 200 OK' do - query_host('pages.gitlab.io') + context 'not existing host' do + it 'responds with 404 Not Found' do + query_host('pages.gitlab.io') + + expect(response).to have_gitlab_http_status(404) + end + end + + context 'custom domain' do + let(:namespace) { create(:namespace, name: 'gitlab-org') } + let(:project) { create(:project, namespace: namespace, name: 'gitlab-ce') } + let!(:pages_domain) { create(:pages_domain, domain: 'pages.gitlab.io', project: project) } + + it 'responds with the correct domain configuration' do + query_host('pages.gitlab.io') + + expect(response).to have_gitlab_http_status(200) + expect(response).to match_response_schema('internal/pages/virtual_domain') + + expect(json_response['certificate']).to eq(pages_domain.certificate) + expect(json_response['key']).to eq(pages_domain.key) - expect(response).to have_gitlab_http_status(200) + lookup_path = json_response['lookup_paths'][0] + expect(lookup_path['prefix']).to eq('/') + expect(lookup_path['source']['path']).to eq('gitlab-org/gitlab-ce/public/') + end end end end |