summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/project/pipeline_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-15 15:09:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-15 15:09:11 +0000
commit10130901f1128c91596c4cbfe14b1e5c9f15032f (patch)
tree18051a0297d9af135e4546689a91b9033bae6f59 /spec/requests/api/graphql/project/pipeline_spec.rb
parent69b0ff9002af73de066a6f28e4a61ccf1fddd9a7 (diff)
downloadgitlab-ce-10130901f1128c91596c4cbfe14b1e5c9f15032f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/graphql/project/pipeline_spec.rb')
-rw-r--r--spec/requests/api/graphql/project/pipeline_spec.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/project/pipeline_spec.rb b/spec/requests/api/graphql/project/pipeline_spec.rb
index 6436fe1e9ef..0a5bcc7a965 100644
--- a/spec/requests/api/graphql/project/pipeline_spec.rb
+++ b/spec/requests/api/graphql/project/pipeline_spec.rb
@@ -235,4 +235,51 @@ RSpec.describe 'getting pipeline information nested in a project' do
end
end
end
+
+ context 'when requesting a specific test suite' do
+ let_it_be(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) }
+ let(:suite_name) { 'test' }
+ let_it_be(:build_ids) { pipeline.latest_builds.pluck(:id) }
+
+ let(:variables) do
+ {
+ path: project.full_path,
+ pipelineIID: pipeline.iid.to_s
+ }
+ end
+
+ let(:query) do
+ <<~GQL
+ query($path: ID!, $pipelineIID: ID!, $buildIds: [ID!]!) {
+ project(fullPath: $path) {
+ pipeline(iid: $pipelineIID) {
+ testSuite(buildIds: $buildIds) {
+ name
+ }
+ }
+ }
+ }
+ GQL
+ end
+
+ it 'can request a test suite by an array of build_ids' do
+ vars = variables.merge(buildIds: build_ids)
+
+ post_graphql(query, current_user: current_user, variables: vars)
+
+ expect(graphql_data_at(:project, :pipeline, :testSuite, :name)).to eq(suite_name)
+ end
+
+ context 'when pipeline has no builds that matches the given build_ids' do
+ let_it_be(:build_ids) { [non_existing_record_id] }
+
+ it 'returns nil' do
+ vars = variables.merge(buildIds: build_ids)
+
+ post_graphql(query, current_user: current_user, variables: vars)
+
+ expect(graphql_data_at(*path, :test_suite)).to be_nil
+ end
+ end
+ end
end