Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-25 03:07:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-25 03:07:44 +0300
commit742d4b0878714b1d4ec098d00434cc940cd792aa (patch)
tree87e4cc6240401c0436e063d6e2bf4eb4cd140f8b /spec
parent0b5e5c78a9d7acbf773d7ba5fd5c2ce9b6ffdb52 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/api/schemas/entities/discussion.json5
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/notes.json5
-rw-r--r--spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb21
-rw-r--r--spec/lib/gitlab/ci/config/external/context_spec.rb31
-rw-r--r--spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb11
-rw-r--r--spec/lib/gitlab/ci/config/external/mapper_spec.rb11
-rw-r--r--spec/services/ci/create_pipeline_service/logger_spec.rb2
-rw-r--r--spec/services/resource_access_tokens/create_service_spec.rb1
8 files changed, 30 insertions, 57 deletions
diff --git a/spec/fixtures/api/schemas/entities/discussion.json b/spec/fixtures/api/schemas/entities/discussion.json
index 45271926547..4af36b5814b 100644
--- a/spec/fixtures/api/schemas/entities/discussion.json
+++ b/spec/fixtures/api/schemas/entities/discussion.json
@@ -103,6 +103,9 @@
"noteable_type": {
"type": "string"
},
+ "project_id": {
+ "type": "integer"
+ },
"resolved": {
"type": "boolean"
},
@@ -207,4 +210,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/spec/fixtures/api/schemas/public_api/v4/notes.json b/spec/fixtures/api/schemas/public_api/v4/notes.json
index 1987a0f2f71..60d6bb90b79 100644
--- a/spec/fixtures/api/schemas/public_api/v4/notes.json
+++ b/spec/fixtures/api/schemas/public_api/v4/notes.json
@@ -78,6 +78,9 @@
"noteable_type": {
"type": "string"
},
+ "project_id": {
+ "type": "integer"
+ },
"resolved": {
"type": "boolean"
},
@@ -122,4 +125,4 @@
],
"additionalProperties": false
}
-} \ No newline at end of file
+}
diff --git a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb
index 48787f2a0d2..f05adb49651 100644
--- a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb
+++ b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb
@@ -29,11 +29,11 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor
end
context 'when the pipeline does belong to a Jira issue' do
- let(:pipeline) { create(:ci_pipeline, merge_request: merge_request) }
+ let(:pipeline) { create(:ci_pipeline, merge_request: merge_request, project: project) }
%i[jira_branch jira_title jira_description].each do |trait|
context "because it belongs to an MR with a #{trait}" do
- let(:merge_request) { create(:merge_request, trait) }
+ let(:merge_request) { create(:merge_request, trait, source_project: project) }
describe '#issue_keys' do
it 'is not empty' do
@@ -48,5 +48,22 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor
end
end
end
+
+ context 'in the pipeline\'s commit messsage' do
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
+ let(:commit_message) { "Merge branch 'staging' into 'master'\n\nFixes bug described in PROJ-1234" }
+
+ before do
+ allow(pipeline).to receive(:git_commit_message).and_return(commit_message)
+ end
+
+ describe '#issue_keys' do
+ it { expect(subject.issue_keys).to match_array(['PROJ-1234']) }
+ end
+
+ describe '#to_json' do
+ it { expect(subject.to_json).to be_valid_json.and match_schema(Atlassian::Schemata.build_info) }
+ end
+ end
end
end
diff --git a/spec/lib/gitlab/ci/config/external/context_spec.rb b/spec/lib/gitlab/ci/config/external/context_spec.rb
index bae898e13eb..f1640822c6b 100644
--- a/spec/lib/gitlab/ci/config/external/context_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/context_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Gitlab::Ci::Config::External::Context, feature_category: :pipelin
context 'with values' do
it { is_expected.to have_attributes(**attributes) }
it { expect(subject.expandset).to eq([]) }
- it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) }
+ it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) }
it { expect(subject.execution_deadline).to eq(0) }
it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) }
it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) }
@@ -27,38 +27,11 @@ RSpec.describe Gitlab::Ci::Config::External::Context, feature_category: :pipelin
it { is_expected.to have_attributes(**attributes) }
it { expect(subject.expandset).to eq([]) }
- it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) }
+ it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) }
it { expect(subject.execution_deadline).to eq(0) }
it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) }
it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) }
end
-
- context 'when FF ci_includes_count_duplicates is disabled' do
- before do
- stub_feature_flags(ci_includes_count_duplicates: false)
- end
-
- context 'with values' do
- it { is_expected.to have_attributes(**attributes) }
- it { expect(subject.expandset).to eq(Set.new) }
- it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) }
- it { expect(subject.execution_deadline).to eq(0) }
- it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) }
- it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) }
- it { expect(subject.variables_hash).to include('a' => 'b') }
- end
-
- context 'without values' do
- let(:attributes) { { project: nil, user: nil, sha: nil } }
-
- it { is_expected.to have_attributes(**attributes) }
- it { expect(subject.expandset).to eq(Set.new) }
- it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) }
- it { expect(subject.execution_deadline).to eq(0) }
- it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) }
- it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) }
- end
- end
end
describe '#set_deadline' do
diff --git a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb
index 2930a05a8a2..b4576fb7a1d 100644
--- a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb
@@ -191,17 +191,6 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper::Verifier, feature_category:
allow(context).to receive(:max_includes).and_return(2)
expect { process }.to raise_error(Gitlab::Ci::Config::External::Mapper::TooManyIncludesError)
end
-
- context 'when FF ci_includes_count_duplicates is disabled' do
- before do
- stub_feature_flags(ci_includes_count_duplicates: false)
- end
-
- it 'does not raise error' do
- allow(context).to receive(:max_includes).and_return(2)
- expect { process }.not_to raise_error
- end
- end
end
end
end
diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb
index a731d0ddba3..56d1ddee4b8 100644
--- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb
@@ -234,17 +234,6 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper, feature_category: :pipeline
process
expect(context.expandset.size).to eq(2)
end
-
- context 'when FF ci_includes_count_duplicates is disabled' do
- before do
- stub_feature_flags(ci_includes_count_duplicates: false)
- end
-
- it 'has expanset with one' do
- process
- expect(context.expandset.size).to eq(1)
- end
- end
end
context 'when passing max number of files' do
diff --git a/spec/services/ci/create_pipeline_service/logger_spec.rb b/spec/services/ci/create_pipeline_service/logger_spec.rb
index ecb24a61075..082a09db69e 100644
--- a/spec/services/ci/create_pipeline_service/logger_spec.rb
+++ b/spec/services/ci/create_pipeline_service/logger_spec.rb
@@ -142,7 +142,7 @@ RSpec.describe Ci::CreatePipelineService, # rubocop: disable RSpec/FilePath
describe 'pipeline includes count' do
before do
- stub_const('Gitlab::Ci::Config::External::Context::MAX_INCLUDES', 2)
+ stub_const('Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES', 2)
end
context 'when the includes count exceeds the maximum' do
diff --git a/spec/services/resource_access_tokens/create_service_spec.rb b/spec/services/resource_access_tokens/create_service_spec.rb
index 3b6f2bc1368..f0eae9554dc 100644
--- a/spec/services/resource_access_tokens/create_service_spec.rb
+++ b/spec/services/resource_access_tokens/create_service_spec.rb
@@ -109,7 +109,6 @@ RSpec.describe ResourceAccessTokens::CreateService, feature_category: :system_ac
end
it 'email is the same as username' do
- expect(SecureRandom).to receive(:hex).at_least(:once).and_return('randomhex')
response = subject
access_token = response.payload[:access_token]