summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorJames Ramsay <james@jramsay.com.au>2018-04-01 17:16:35 -0400
committerJames Ramsay <james@jramsay.com.au>2018-04-27 11:00:52 +0100
commitb65fcc320d65367973a58a01618914056993541b (patch)
treed845d07c49dcba94ebb12781fb6effc2cdbd8ac4 /spec/finders
parentc73b5d31e680b175b2592d299c901bdcb43bca9f (diff)
downloadgitlab-ce-b65fcc320d65367973a58a01618914056993541b.tar.gz
Add sha filter to list pipelines
To find the pipeline for a specific sha requires scanning the list of all pipelines for a ref that contains the sha. This makes it hard to find the pipeline id needed to access a trace for a specific job run in the pipeline using the API.
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/pipelines_finder_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb
index 2b19cda35b0..d6253b605b9 100644
--- a/spec/finders/pipelines_finder_spec.rb
+++ b/spec/finders/pipelines_finder_spec.rb
@@ -203,5 +203,25 @@ describe PipelinesFinder do
end
end
end
+
+ context 'when sha is specified' do
+ let!(:pipeline) { create(:ci_pipeline, project: project, sha: '97de212e80737a608d939f648d959671fb0a0142') }
+
+ context 'when sha exists' do
+ let(:params) { { sha: '97de212e80737a608d939f648d959671fb0a0142' } }
+
+ it 'returns matched pipelines' do
+ is_expected.to eq([pipeline])
+ end
+ end
+
+ context 'when sha does not exist' do
+ let(:params) { { sha: 'invalid-sha' } }
+
+ it 'returns empty' do
+ is_expected.to be_empty
+ end
+ end
+ end
end
end