diff options
author | Stan Hu <stanhu@gmail.com> | 2018-06-29 15:22:05 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-06-29 15:33:16 -0700 |
commit | 05a9c6b21100729c49b122f3085e1df09f656fc6 (patch) | |
tree | 4330589d1aff63e3a0625119e94d1e72491f1f6f /spec | |
parent | 70cf3bff18e358beaff9efc52906748636718d99 (diff) | |
download | gitlab-ce-05a9c6b21100729c49b122f3085e1df09f656fc6.tar.gz |
Fix Bamboo CI status not showing for branch plans
The original API that queries by label (`/rest/api/latest/result?label=#{sha1}`)
only works for results from main plans and not branch plans. The
`/rest/api/latest/result/byChangeset/#{sha1}` endpoint gives results from
branch plans but not for the first push to the branch. Subsequent pushes
work.
For more details, see https://jira.atlassian.com/browse/BAM-16121.
Closes #1355
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_services/bamboo_service_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/models/project_services/bamboo_service_spec.rb b/spec/models/project_services/bamboo_service_spec.rb index 85baaccf035..f4f7afb1b92 100644 --- a/spec/models/project_services/bamboo_service_spec.rb +++ b/spec/models/project_services/bamboo_service_spec.rb @@ -120,6 +120,14 @@ describe BambooService, :use_clean_rails_memory_store_caching do end end + describe '#execute' do + it 'runs update and build action' do + stub_update_and_build_request + + subject.execute(Gitlab::DataBuilder::Push::SAMPLE_DATA) + end + end + describe '#build_page' do it 'returns the contents of the reactive cache' do stub_reactive_cache(service, { build_page: 'foo' }, 'sha', 'ref') @@ -216,10 +224,20 @@ describe BambooService, :use_clean_rails_memory_store_caching do end end + def stub_update_and_build_request(status: 200, body: nil) + bamboo_full_url = 'http://gitlab.com/bamboo/updateAndBuild.action?buildKey=foo&os_authType=basic' + + stub_bamboo_request(bamboo_full_url, status, body) + end + def stub_request(status: 200, body: nil) - bamboo_full_url = 'http://gitlab.com/bamboo/rest/api/latest/result?label=123&os_authType=basic' + bamboo_full_url = 'http://gitlab.com/bamboo/rest/api/latest/result/byChangeset/123?os_authType=basic' + + stub_bamboo_request(bamboo_full_url, status, body) + end - WebMock.stub_request(:get, bamboo_full_url).to_return( + def stub_bamboo_request(url, status, body) + WebMock.stub_request(:get, url).to_return( status: status, headers: { 'Content-Type' => 'application/json' }, body: body |