diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-11-20 20:43:50 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-11-21 15:01:06 +0100 |
commit | e3fb0740228219433a4623dc0b9325785e23ae16 (patch) | |
tree | c762d41ca6000f6336c819029f0799fea1651cee /spec/requests/ci | |
parent | 596bbf670c95a513cce703dce756e957a143c596 (diff) | |
download | gitlab-ce-e3fb0740228219433a4623dc0b9325785e23ae16.tar.gz |
Send credentials array with build data
Diffstat (limited to 'spec/requests/ci')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index bd4d3d61714..c5e498601e6 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -58,28 +58,38 @@ describe Ci::API::API do expect { register_builds }.to change { runner.reload.contacted_at } end - context 'when registry is enabled' do - before do - stub_container_registry_config(enabled: true, host_port: 'registry.example.com:5005') + context 'registry credentials' do + let(:registry_credentials) do + { 'type' => 'docker-registry', + 'url' => 'registry.example.com:5005', + 'username' => 'gitlab-ci-token', + 'password' => build.token } end - it 'sends registry_url key' do - register_builds info: { platform: :darwin } + context 'when registry is enabled' do + before do + stub_container_registry_config(enabled: true, host_port: 'registry.example.com:5005') + end - expect(json_response).to have_key('registry_url') - expect(json_response['registry_url']).to eq("registry.example.com:5005") - end - end + it 'sends registry credentials key' do + register_builds info: { platform: :darwin } - context 'when registry is disabled' do - before do - stub_container_registry_config(enabled: false, host_port: 'registry.example.com:5005') + expect(json_response).to have_key('credentials') + expect(json_response['credentials']).to include(registry_credentials) + end end - it 'does not send registry_url key' do - register_builds info: { platform: :darwin } + context 'when registry is disabled' do + before do + stub_container_registry_config(enabled: false, host_port: 'registry.example.com:5005') + end - expect(json_response).not_to have_key('registry_url') + it 'does not send registry credentials' do + register_builds info: { platform: :darwin } + + expect(json_response).to have_key('credentials') + expect(json_response['credentials']).not_to include(registry_credentials) + end end end end |