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/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 09:11:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 09:11:44 +0300
commita5872a7f2bbb54bc6868e862fa1c1729d8182832 (patch)
treef614ba69284f3237471ae503a6e0a1bfc745c310 /spec/lib
parentc593b347c9e0c362ef123af961e597d709e75521 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb27
-rw-r--r--spec/lib/gitlab/metrics/web_transaction_spec.rb4
-rw-r--r--spec/lib/gitlab/omniauth_initializer_spec.rb12
-rw-r--r--spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb4
-rw-r--r--spec/lib/gitlab/sidekiq_death_handler_spec.rb8
-rw-r--r--spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb48
-rw-r--r--spec/lib/gitlab/slug/environment_spec.rb26
-rw-r--r--spec/lib/gitlab/tracking_spec.rb24
-rw-r--r--spec/lib/gitlab/usage_data/topology_spec.rb16
-rw-r--r--spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb4
-rw-r--r--spec/lib/gitlab/usage_data_counters/note_counter_spec.rb2
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb8
-rw-r--r--spec/lib/gitlab/utils_spec.rb2
-rw-r--r--spec/lib/gitlab/word_diff/parser_spec.rb18
-rw-r--r--spec/lib/marginalia_spec.rb20
-rw-r--r--spec/lib/security/ci_configuration/sast_build_action_spec.rb58
16 files changed, 156 insertions, 125 deletions
diff --git a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
index 9451a6bd34a..3ac483c8ab7 100644
--- a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
+++ b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
connection.execute(<<~SQL)
CREATE TABLE #{table_name} (
id bigint primary key not null,
- data bigint
+ data bigint default 0
);
insert into #{table_name} (id) select i from generate_series(1, 1000) g(i);
@@ -40,10 +40,12 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
:id, :data,
batch_size: 100,
job_interval: 5.minutes) # job_interval is skipped when testing
- described_class.new(result_dir: result_dir, connection: connection).run_jobs(for_duration: 1.minute)
- unmigrated_row_count = define_batchable_model(table_name).where('id != data').count
- expect(unmigrated_row_count).to eq(0)
+ # Expect that running sampling for this migration processes some of the rows. Sampling doesn't run
+ # over every row in the table, so this does not completely migrate the table.
+ expect { described_class.new(result_dir: result_dir, connection: connection).run_jobs(for_duration: 1.minute) }
+ .to change { define_batchable_model(table_name).where('id IS DISTINCT FROM data').count }
+ .by_at_most(-1)
end
end
@@ -62,7 +64,7 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
described_class.new(result_dir: result_dir, connection: connection).run_jobs(for_duration: 3.minutes)
- expect(calls.count).to eq(10) # 1000 rows / batch size 100 = 10
+ expect(calls).not_to be_empty
end
context 'with multiple jobs to run' do
@@ -92,4 +94,19 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
end
end
end
+
+ context 'choosing uniform batches to run' do
+ subject { described_class.new(result_dir: result_dir, connection: connection) }
+
+ describe '#uniform_fractions' do
+ it 'generates evenly distributed sequences of fractions' do
+ received = subject.uniform_fractions.take(9)
+ expected = [0, 1, 1.0 / 2, 1.0 / 4, 3.0 / 4, 1.0 / 8, 3.0 / 8, 5.0 / 8, 7.0 / 8]
+
+ # All the fraction numerators are small integers, and all denominators are powers of 2, so these
+ # fit perfectly into floating point numbers with zero loss of precision
+ expect(received).to eq(expected)
+ end
+ end
+ end
end
diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb
index d6590efcf4f..dc59fa804c4 100644
--- a/spec/lib/gitlab/metrics/web_transaction_spec.rb
+++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb
@@ -66,8 +66,8 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
before do
route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)')
endpoint = double(:endpoint, route: route,
- options: { for: API::Projects, path: [":id/archive"] },
- namespace: "/projects")
+ options: { for: API::Projects, path: [":id/archive"] },
+ namespace: "/projects")
env['api.endpoint'] = endpoint
diff --git a/spec/lib/gitlab/omniauth_initializer_spec.rb b/spec/lib/gitlab/omniauth_initializer_spec.rb
index c91b14a33ba..563c97fa2cb 100644
--- a/spec/lib/gitlab/omniauth_initializer_spec.rb
+++ b/spec/lib/gitlab/omniauth_initializer_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there is an app_id and an app_secret, and an array of args' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'app_id' => 1,
'app_secret' => 2,
'args' => %w[one two three]
@@ -46,7 +46,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there is an app_id and an app_secret, and an array of args, and default values' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'app_id' => 1,
'app_secret' => 2,
'args' => %w[one two three]
@@ -68,7 +68,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there is an app_id and an app_secret, and a hash of args' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'app_id' => 1,
'app_secret' => 2,
'args' => { 'foo' => 100, 'bar' => 200, 'nested' => { 'value' => 300 } }
@@ -84,7 +84,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there is an app_id and an app_secret, and a hash of args, and default arguments' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'app_id' => 1,
'app_secret' => 2,
'args' => { 'foo' => 100, 'bar' => 200, 'nested' => { 'value' => 300 } }
@@ -106,7 +106,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there is an app_id and an app_secret, no args, and default values' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'app_id' => 1,
'app_secret' => 2
}
@@ -127,7 +127,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
context 'when there are args, of an unsupported type' do
let(:provider) do
{
- 'name' => 'unknown',
+ 'name' => 'unknown',
'args' => 1
}
end
diff --git a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb
index 635f572daef..dff04a2e509 100644
--- a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb
+++ b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb
@@ -326,7 +326,7 @@ RSpec.describe Gitlab::SidekiqDaemon::MemoryKiller do
class: described_class.to_s,
signal: signal,
pid: pid,
- message: "sending Sidekiq worker PID-#{pid} #{signal} (#{explanation})")
+ message: "sending Sidekiq worker PID-#{pid} #{signal} (#{explanation})")
expect(Process).to receive(:kill).with(signal, pid).ordered
subject
@@ -340,7 +340,7 @@ RSpec.describe Gitlab::SidekiqDaemon::MemoryKiller do
class: described_class.to_s,
signal: signal,
pid: pid,
- message: "sending Sidekiq worker PGRP-#{pid} #{signal} (#{explanation})")
+ message: "sending Sidekiq worker PGRP-#{pid} #{signal} (#{explanation})")
expect(Process).to receive(:kill).with(signal, 0).ordered
subject
diff --git a/spec/lib/gitlab/sidekiq_death_handler_spec.rb b/spec/lib/gitlab/sidekiq_death_handler_spec.rb
index e3f9f8277a0..434642bf3ef 100644
--- a/spec/lib/gitlab/sidekiq_death_handler_spec.rb
+++ b/spec/lib/gitlab/sidekiq_death_handler_spec.rb
@@ -24,8 +24,8 @@ RSpec.describe Gitlab::SidekiqDeathHandler, :clean_gitlab_redis_queues do
expect(described_class.counter)
.to receive(:increment)
.with({ queue: 'test_queue', worker: 'TestWorker',
- urgency: 'low', external_dependencies: 'yes',
- feature_category: 'users', boundary: 'cpu' })
+ urgency: 'low', external_dependencies: 'yes',
+ feature_category: 'users', boundary: 'cpu' })
described_class.handler({ 'class' => 'TestWorker', 'queue' => 'test_queue' }, nil)
end
@@ -40,8 +40,8 @@ RSpec.describe Gitlab::SidekiqDeathHandler, :clean_gitlab_redis_queues do
expect(described_class.counter)
.to receive(:increment)
.with({ queue: 'test_queue', worker: 'TestWorker',
- urgency: '', external_dependencies: 'no',
- feature_category: '', boundary: '' })
+ urgency: '', external_dependencies: 'no',
+ feature_category: '', boundary: '' })
described_class.handler({ 'class' => 'TestWorker', 'queue' => 'test_queue' }, nil)
end
diff --git a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb
index d6d24ea3a24..52b50a143fc 100644
--- a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb
+++ b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb
@@ -22,39 +22,39 @@ RSpec.describe Gitlab::SidekiqMiddleware::ServerMetrics do
expect(completion_seconds_metric)
.to receive(:get).with({ queue: 'merge',
- worker: 'MergeWorker',
- urgency: 'high',
- external_dependencies: 'no',
- feature_category: 'source_code_management',
- boundary: '',
- job_status: 'done' })
+ worker: 'MergeWorker',
+ urgency: 'high',
+ external_dependencies: 'no',
+ feature_category: 'source_code_management',
+ boundary: '',
+ job_status: 'done' })
expect(completion_seconds_metric)
.to receive(:get).with({ queue: 'merge',
- worker: 'MergeWorker',
- urgency: 'high',
- external_dependencies: 'no',
- feature_category: 'source_code_management',
- boundary: '',
- job_status: 'fail' })
+ worker: 'MergeWorker',
+ urgency: 'high',
+ external_dependencies: 'no',
+ feature_category: 'source_code_management',
+ boundary: '',
+ job_status: 'fail' })
expect(completion_seconds_metric)
.to receive(:get).with({ queue: 'default',
- worker: 'Ci::BuildFinishedWorker',
- urgency: 'high',
- external_dependencies: 'no',
- feature_category: 'continuous_integration',
- boundary: 'cpu',
- job_status: 'done' })
+ worker: 'Ci::BuildFinishedWorker',
+ urgency: 'high',
+ external_dependencies: 'no',
+ feature_category: 'continuous_integration',
+ boundary: 'cpu',
+ job_status: 'done' })
expect(completion_seconds_metric)
.to receive(:get).with({ queue: 'default',
- worker: 'Ci::BuildFinishedWorker',
- urgency: 'high',
- external_dependencies: 'no',
- feature_category: 'continuous_integration',
- boundary: 'cpu',
- job_status: 'fail' })
+ worker: 'Ci::BuildFinishedWorker',
+ urgency: 'high',
+ external_dependencies: 'no',
+ feature_category: 'continuous_integration',
+ boundary: 'cpu',
+ job_status: 'fail' })
described_class.initialize_process_metrics
end
diff --git a/spec/lib/gitlab/slug/environment_spec.rb b/spec/lib/gitlab/slug/environment_spec.rb
index 5456501eb8b..e8f0fba27b2 100644
--- a/spec/lib/gitlab/slug/environment_spec.rb
+++ b/spec/lib/gitlab/slug/environment_spec.rb
@@ -7,21 +7,21 @@ RSpec.describe Gitlab::Slug::Environment do
{
"staging-12345678901234567" => "staging-123456789-q517sa",
"9-staging-123456789012345" => "env-9-staging-123-q517sa",
- "staging-1234567890123456" => "staging-1234567890123456",
+ "staging-1234567890123456" => "staging-1234567890123456",
"staging-1234567890123456-" => "staging-123456789-q517sa",
- "production" => "production",
- "PRODUCTION" => "production-q517sa",
- "review/1-foo" => "review-1-foo-q517sa",
- "1-foo" => "env-1-foo-q517sa",
- "1/foo" => "env-1-foo-q517sa",
- "foo-" => "foo",
- "foo--bar" => "foo-bar-q517sa",
- "foo**bar" => "foo-bar-q517sa",
- "*-foo" => "env-foo-q517sa",
- "staging-12345678-" => "staging-12345678",
+ "production" => "production",
+ "PRODUCTION" => "production-q517sa",
+ "review/1-foo" => "review-1-foo-q517sa",
+ "1-foo" => "env-1-foo-q517sa",
+ "1/foo" => "env-1-foo-q517sa",
+ "foo-" => "foo",
+ "foo--bar" => "foo-bar-q517sa",
+ "foo**bar" => "foo-bar-q517sa",
+ "*-foo" => "env-foo-q517sa",
+ "staging-12345678-" => "staging-12345678",
"staging-12345678-01234567" => "staging-12345678-q517sa",
- "" => "env-q517sa",
- nil => "env-q517sa"
+ "" => "env-q517sa",
+ nil => "env-q517sa"
}.each do |name, matcher|
before do
# ('a' * 64).to_i(16).to_s(36).last(6) gives 'q517sa'
diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb
index 028c985f3b3..7f30d794aee 100644
--- a/spec/lib/gitlab/tracking_spec.rb
+++ b/spec/lib/gitlab/tracking_spec.rb
@@ -132,9 +132,16 @@ RSpec.describe Gitlab::Tracking do
expect(args[:context].last).to eq(other_context)
end
- described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5,
- context: [other_context], project: project, user: user, namespace: namespace,
- extra_key_1: 'extra value 1', extra_key_2: 'extra value 2')
+ described_class.event('category', 'action',
+ label: 'label',
+ property: 'property',
+ value: 1.5,
+ context: [other_context],
+ project: project,
+ user: user,
+ namespace: namespace,
+ extra_key_1: 'extra value 1',
+ extra_key_2: 'extra value 2')
end
end
@@ -197,8 +204,15 @@ RSpec.describe Gitlab::Tracking do
expect(args[:extra_key_1]).to eq('extra value 1')
end
- described_class.definition('filename', category: nil, action: nil, label: 'label', property: '...',
- project: project, user: user, namespace: namespace, extra_key_1: 'extra value 1')
+ described_class.definition('filename',
+ category: nil,
+ action: nil,
+ label: 'label',
+ property: '...',
+ project: project,
+ user: user,
+ namespace: namespace,
+ extra_key_1: 'extra value 1')
end
end
diff --git a/spec/lib/gitlab/usage_data/topology_spec.rb b/spec/lib/gitlab/usage_data/topology_spec.rb
index 737580e3493..dfdf8eaabe8 100644
--- a/spec/lib/gitlab/usage_data/topology_spec.rb
+++ b/spec/lib/gitlab/usage_data/topology_spec.rb
@@ -187,7 +187,7 @@ RSpec.describe Gitlab::UsageData::Topology do
[
{
'metric' => { 'instance' => 'localhost:9100' },
- 'value' => [1000, '512']
+ 'value' => [1000, '512']
}
]
end
@@ -196,7 +196,7 @@ RSpec.describe Gitlab::UsageData::Topology do
[
{
'metric' => { 'instance' => 'localhost:9100' },
- 'value' => [1000, '0.35']
+ 'value' => [1000, '0.35']
}
]
end
@@ -224,23 +224,23 @@ RSpec.describe Gitlab::UsageData::Topology do
[
{
'metric' => { 'instance' => 'localhost:8080', 'job' => 'gitlab-rails' },
- 'value' => [1000, '10']
+ 'value' => [1000, '10']
},
{
'metric' => { 'instance' => '127.0.0.1:8090', 'job' => 'gitlab-sidekiq' },
- 'value' => [1000, '11']
+ 'value' => [1000, '11']
},
{
'metric' => { 'instance' => '0.0.0.0:9090', 'job' => 'prometheus' },
- 'value' => [1000, '12']
+ 'value' => [1000, '12']
},
{
'metric' => { 'instance' => '[::1]:1234', 'job' => 'redis' },
- 'value' => [1000, '13']
+ 'value' => [1000, '13']
},
{
'metric' => { 'instance' => '[::]:1234', 'job' => 'postgres' },
- 'value' => [1000, '14']
+ 'value' => [1000, '14']
}
]
end
@@ -640,7 +640,7 @@ RSpec.describe Gitlab::UsageData::Topology do
.and_return(result || [
{
'metric' => { 'instance' => 'instance1:8080', 'job' => 'gitlab-rails' },
- 'value' => [1000, '300']
+ 'value' => [1000, '300']
},
{
'metric' => { 'instance' => 'instance1:8090', 'job' => 'gitlab-sidekiq' },
diff --git a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
index 3f44cfdcf27..74e63d219bd 100644
--- a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
@@ -100,9 +100,9 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
subject
expect_snowplow_event(
- category: 'merge_requests',
+ category: 'merge_requests',
action: 'i_code_review_user_approve_mr',
- namespace: target_project.namespace,
+ namespace: target_project.namespace,
user: user,
project: target_project
)
diff --git a/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb
index 7e8f0172e06..687f8c2cd41 100644
--- a/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/note_counter_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe Gitlab::UsageDataCounters::NoteCounter, :clean_gitlab_redis_share
let(:expected_totals) do
{ snippet_comment: 3,
merge_request_comment: 4,
- commit_comment: 5 }
+ commit_comment: 5 }
end
before do
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index 692b6483149..3b0cc0fb16b 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -583,10 +583,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it 'gathers object store usage correctly' do
expect(subject[:object_store]).to eq(
{ artifacts: { enabled: true, object_store: { enabled: true, direct_upload: true, background_upload: false, provider: "AWS" } },
- external_diffs: { enabled: false },
- lfs: { enabled: true, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } },
- uploads: { enabled: nil, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } },
- packages: { enabled: true, object_store: { enabled: false, direct_upload: false, background_upload: true, provider: "AWS" } } }
+ external_diffs: { enabled: false },
+ lfs: { enabled: true, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } },
+ uploads: { enabled: nil, object_store: { enabled: false, direct_upload: true, background_upload: false, provider: "AWS" } },
+ packages: { enabled: true, object_store: { enabled: false, direct_upload: false, background_upload: true, provider: "AWS" } } }
)
end
diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb
index ad1a65ffae8..61323f0646b 100644
--- a/spec/lib/gitlab/utils_spec.rb
+++ b/spec/lib/gitlab/utils_spec.rb
@@ -174,7 +174,7 @@ RSpec.describe Gitlab::Utils do
{
'TEST' => 'test',
'project_with_underscores' => 'project-with-underscores',
- 'namespace/project' => 'namespace-project',
+ 'namespace/project' => 'namespace-project',
'a' * 70 => 'a' * 63,
'test_trailing_' => 'test-trailing'
}.each do |original, expected|
diff --git a/spec/lib/gitlab/word_diff/parser_spec.rb b/spec/lib/gitlab/word_diff/parser_spec.rb
index 915c3f5a0f9..18109a8160b 100644
--- a/spec/lib/gitlab/word_diff/parser_spec.rb
+++ b/spec/lib/gitlab/word_diff/parser_spec.rb
@@ -42,18 +42,18 @@ RSpec.describe Gitlab::WordDiff::Parser do
{ index: 1, old_pos: 2, new_pos: 2, text: 'Unchanged line', type: nil, marker_ranges: [] },
{ index: 2, old_pos: 3, new_pos: 3, text: '', type: nil, marker_ranges: [] },
{ index: 3, old_pos: 4, new_pos: 4, text: 'Old changeNew addition unchanged content', type: nil,
- marker_ranges: [
- Gitlab::MarkerRange.new(0, 9, mode: :deletion),
- Gitlab::MarkerRange.new(10, 21, mode: :addition)
- ] },
+ marker_ranges: [
+ Gitlab::MarkerRange.new(0, 9, mode: :deletion),
+ Gitlab::MarkerRange.new(10, 21, mode: :addition)
+ ] },
{ index: 4, old_pos: 50, new_pos: 50, text: '@@ -50,14 +50,13 @@', type: 'match', marker_ranges: [] },
{ index: 5, old_pos: 50, new_pos: 50, text: 'First change same same same_removed_added_end of the line', type: nil,
- marker_ranges: [
- Gitlab::MarkerRange.new(0, 11, mode: :addition),
- Gitlab::MarkerRange.new(28, 35, mode: :deletion),
- Gitlab::MarkerRange.new(36, 41, mode: :addition)
- ] },
+ marker_ranges: [
+ Gitlab::MarkerRange.new(0, 11, mode: :addition),
+ Gitlab::MarkerRange.new(28, 35, mode: :deletion),
+ Gitlab::MarkerRange.new(36, 41, mode: :addition)
+ ] },
{ index: 6, old_pos: 51, new_pos: 51, text: '', type: nil, marker_ranges: [] }
]
diff --git a/spec/lib/marginalia_spec.rb b/spec/lib/marginalia_spec.rb
index 59add4e8347..5f405e71d79 100644
--- a/spec/lib/marginalia_spec.rb
+++ b/spec/lib/marginalia_spec.rb
@@ -45,8 +45,8 @@ RSpec.describe 'Marginalia spec' do
let(:component_map) do
{
- "application" => "test",
- "endpoint_id" => "MarginaliaTestController#first_user",
+ "application" => "test",
+ "endpoint_id" => "MarginaliaTestController#first_user",
"correlation_id" => correlation_id,
"db_config_name" => "main"
}
@@ -62,8 +62,8 @@ RSpec.describe 'Marginalia spec' do
let(:recorded) { ActiveRecord::QueryRecorder.new { make_request(correlation_id, :first_ci_pipeline) } }
let(:component_map) do
{
- "application" => "test",
- "endpoint_id" => "MarginaliaTestController#first_ci_pipeline",
+ "application" => "test",
+ "endpoint_id" => "MarginaliaTestController#first_ci_pipeline",
"correlation_id" => correlation_id,
"db_config_name" => 'ci'
}
@@ -104,10 +104,10 @@ RSpec.describe 'Marginalia spec' do
let(:component_map) do
{
- "application" => "sidekiq",
- "endpoint_id" => "MarginaliaTestJob",
+ "application" => "sidekiq",
+ "endpoint_id" => "MarginaliaTestJob",
"correlation_id" => sidekiq_job['correlation_id'],
- "jid" => sidekiq_job['jid'],
+ "jid" => sidekiq_job['jid'],
"db_config_name" => "main"
}
end
@@ -129,9 +129,9 @@ RSpec.describe 'Marginalia spec' do
let(:component_map) do
{
- "application" => "sidekiq",
- "endpoint_id" => "ActionMailer::MailDeliveryJob",
- "jid" => delivery_job.job_id,
+ "application" => "sidekiq",
+ "endpoint_id" => "ActionMailer::MailDeliveryJob",
+ "jid" => delivery_job.job_id,
"db_config_name" => "main"
}
end
diff --git a/spec/lib/security/ci_configuration/sast_build_action_spec.rb b/spec/lib/security/ci_configuration/sast_build_action_spec.rb
index 611a886d252..381ea60e7f5 100644
--- a/spec/lib/security/ci_configuration/sast_build_action_spec.rb
+++ b/spec/lib/security/ci_configuration/sast_build_action_spec.rb
@@ -33,12 +33,12 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
params.merge( { analyzers:
[
{
- name: "bandit",
- enabled: false
+ name: "bandit",
+ enabled: false
},
{
- name: "brakeman",
- enabled: true,
+ name: "brakeman",
+ enabled: true,
variables: [
{ field: "SAST_BRAKEMAN_LEVEL",
default_value: "1",
@@ -46,8 +46,8 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
]
},
{
- name: "flawfinder",
- enabled: true,
+ name: "flawfinder",
+ enabled: true,
variables: [
{ field: "SAST_FLAWFINDER_LEVEL",
default_value: "1",
@@ -62,12 +62,12 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
params.merge( { analyzers:
[
{
- name: "flawfinder",
- enabled: true
+ name: "flawfinder",
+ enabled: true
},
{
- name: "brakeman",
- enabled: true
+ name: "brakeman",
+ enabled: true
}
] }
)
@@ -219,49 +219,49 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
def existing_gitlab_ci_and_template_array_without_sast
{ "stages" => %w(test security),
- "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
- "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
- "include" => [{ "template" => "existing.yml" }] }
+ "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
+ "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
+ "include" => [{ "template" => "existing.yml" }] }
end
def existing_gitlab_ci_and_single_template_with_sast_and_default_stage
{ "stages" => %w(test),
- "variables" => { "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
- "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "test" },
- "include" => { "template" => "Security/SAST.gitlab-ci.yml" } }
+ "variables" => { "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
+ "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "test" },
+ "include" => { "template" => "Security/SAST.gitlab-ci.yml" } }
end
def existing_gitlab_ci_and_single_template_without_sast
{ "stages" => %w(test security),
- "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
- "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
- "include" => { "template" => "existing.yml" } }
+ "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
+ "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
+ "include" => { "template" => "existing.yml" } }
end
def existing_gitlab_ci_with_no_variables
{ "stages" => %w(test security),
- "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
- "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
+ "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
+ "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
end
def existing_gitlab_ci_with_no_sast_section
{ "stages" => %w(test security),
- "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
- "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
+ "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
+ "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
end
def existing_gitlab_ci_with_no_sast_variables
{ "stages" => %w(test security),
- "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
- "sast" => { "stage" => "security" },
- "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
+ "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "localhost:5000/analyzers" },
+ "sast" => { "stage" => "security" },
+ "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
end
def existing_gitlab_ci
{ "stages" => %w(test security),
- "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "bad_prefix" },
- "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
- "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
+ "variables" => { "RANDOM" => "make sure this persists", "SECURE_ANALYZERS_PREFIX" => "bad_prefix" },
+ "sast" => { "variables" => { "SEARCH_MAX_DEPTH" => 1 }, "stage" => "security" },
+ "include" => [{ "template" => "Security/SAST.gitlab-ci.yml" }] }
end
end