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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
commit7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch)
tree5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/tooling
parent185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff)
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/tooling')
-rw-r--r--spec/tooling/danger/project_helper_spec.rb6
-rw-r--r--spec/tooling/lib/tooling/find_codeowners_spec.rb4
-rw-r--r--spec/tooling/lib/tooling/helm3_client_spec.rb26
-rw-r--r--spec/tooling/rspec_flaky/example_spec.rb9
-rw-r--r--spec/tooling/rspec_flaky/flaky_example_spec.rb79
-rw-r--r--spec/tooling/rspec_flaky/flaky_examples_collection_spec.rb3
-rw-r--r--spec/tooling/rspec_flaky/listener_spec.rb2
-rw-r--r--spec/tooling/rspec_flaky/report_spec.rb1
8 files changed, 56 insertions, 74 deletions
diff --git a/spec/tooling/danger/project_helper_spec.rb b/spec/tooling/danger/project_helper_spec.rb
index 6793a4b8de3..f9ad9ed13c2 100644
--- a/spec/tooling/danger/project_helper_spec.rb
+++ b/spec/tooling/danger/project_helper_spec.rb
@@ -33,6 +33,12 @@ RSpec.describe Tooling::Danger::ProjectHelper do
where(:path, :expected_categories) do
'glfm_specification/example_snapshots/prosemirror_json.yml' | [:frontend]
'glfm_specification/input/glfm_anything.yml' | [:frontend, :backend]
+
+ 'doc/api/graphql/reference/index.md' | [:docs, :backend]
+ 'doc/api/graphql/reference/some_other_file.txt' | [:docs, :backend]
+ 'doc/api/openapi/openapi.yaml' | [:docs, :backend]
+ 'doc/api/openapi/any_other_file.yaml' | [:docs, :backend]
+
'usage_data.rb' | [:database, :backend, :product_intelligence]
'doc/foo.md' | [:docs]
'CONTRIBUTING.md' | [:docs]
diff --git a/spec/tooling/lib/tooling/find_codeowners_spec.rb b/spec/tooling/lib/tooling/find_codeowners_spec.rb
index 5f6f83ab2c7..e75793b69c6 100644
--- a/spec/tooling/lib/tooling/find_codeowners_spec.rb
+++ b/spec/tooling/lib/tooling/find_codeowners_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Tooling::FindCodeowners do
}
},
'[Compliance]': {
- '@gitlab-org/manage/compliance': {
+ '@gitlab-org/govern/compliance': {
entries: %w[
/ee/app/services/audit_events/build_service.rb
],
@@ -115,7 +115,7 @@ RSpec.describe Tooling::FindCodeowners do
it 'retains the array and expands the patterns for the compliance group' do
compliance = subject.load_definitions.dig(
:'[Compliance]',
- :'@gitlab-org/manage/compliance')
+ :'@gitlab-org/govern/compliance')
expect(compliance).to eq(
entries: %w[
diff --git a/spec/tooling/lib/tooling/helm3_client_spec.rb b/spec/tooling/lib/tooling/helm3_client_spec.rb
index 41c51ec5754..52d1b5a1567 100644
--- a/spec/tooling/lib/tooling/helm3_client_spec.rb
+++ b/spec/tooling/lib/tooling/helm3_client_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Tooling::Helm3Client do
describe '#releases' do
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
+ .with([%(helm list --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.releases.to_a }.to raise_error(described_class::CommandFailedError)
@@ -43,7 +43,7 @@ RSpec.describe Tooling::Helm3Client do
it 'calls helm list with default arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
+ .with([%(helm list --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
subject.releases.to_a
@@ -51,7 +51,7 @@ RSpec.describe Tooling::Helm3Client do
it 'calls helm list with extra arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json --deployed)])
+ .with([%(helm list --max 256 --offset 0 --output json --deployed)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
subject.releases(args: ['--deployed']).to_a
@@ -59,7 +59,7 @@ RSpec.describe Tooling::Helm3Client do
it 'returns a list of Release objects' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json --deployed)])
+ .with([%(helm list --max 256 --offset 0 --output json --deployed)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page2, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_empty, '', double(success?: true)))
@@ -80,13 +80,13 @@ RSpec.describe Tooling::Helm3Client do
it 'automatically paginates releases' do
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
+ .with([%(helm list --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page1, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 256 --output json)])
+ .with([%(helm list --max 256 --offset 256 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page2, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
- .with([%(helm list --namespace "#{namespace}" --max 256 --offset 512 --output json)])
+ .with([%(helm list --max 256 --offset 512 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_empty, '', double(success?: true)))
releases = subject.releases.to_a
@@ -98,7 +98,7 @@ RSpec.describe Tooling::Helm3Client do
describe '#delete' do
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm uninstall --namespace "#{namespace}" #{release_name})])
+ .with([%(helm uninstall #{release_name})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.delete(release_name: release_name) }.to raise_error(described_class::CommandFailedError)
@@ -106,7 +106,7 @@ RSpec.describe Tooling::Helm3Client do
it 'calls helm uninstall with default arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm uninstall --namespace "#{namespace}" #{release_name})])
+ .with([%(helm uninstall #{release_name})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
expect(subject.delete(release_name: release_name)).to eq('')
@@ -117,16 +117,16 @@ RSpec.describe Tooling::Helm3Client do
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm uninstall --namespace "#{namespace}" #{release_name.join(' ')})])
- .and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
+ .with([%(helm uninstall #{release_name.join(' ')})])
+ .and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.delete(release_name: release_name) }.to raise_error(described_class::CommandFailedError)
end
it 'calls helm uninstall with multiple release names' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
- .with([%(helm uninstall --namespace "#{namespace}" #{release_name.join(' ')})])
- .and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
+ .with([%(helm uninstall #{release_name.join(' ')})])
+ .and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
expect(subject.delete(release_name: release_name)).to eq('')
end
diff --git a/spec/tooling/rspec_flaky/example_spec.rb b/spec/tooling/rspec_flaky/example_spec.rb
index 8ff280fd855..d001ed32444 100644
--- a/spec/tooling/rspec_flaky/example_spec.rb
+++ b/spec/tooling/rspec_flaky/example_spec.rb
@@ -9,7 +9,8 @@ RSpec.describe RspecFlaky::Example do
metadata: {
file_path: 'spec/foo/bar_spec.rb',
line_number: 2,
- full_description: 'hello world'
+ full_description: 'hello world',
+ feature_category: :feature_category
},
execution_result: double(status: 'passed', exception: 'BOOM!'),
attempts: 1
@@ -89,4 +90,10 @@ RSpec.describe RspecFlaky::Example do
expect(subject.exception).to eq(rspec_example.execution_result.exception)
end
end
+
+ describe '#feature_category' do
+ it 'returns the metadata[:feature_category] of the RSpec::Core::Example' do
+ expect(subject.feature_category).to eq(rspec_example.metadata[:feature_category])
+ end
+ end
end
diff --git a/spec/tooling/rspec_flaky/flaky_example_spec.rb b/spec/tooling/rspec_flaky/flaky_example_spec.rb
index 03436ee1cbd..511f3286f56 100644
--- a/spec/tooling/rspec_flaky/flaky_example_spec.rb
+++ b/spec/tooling/rspec_flaky/flaky_example_spec.rb
@@ -9,30 +9,14 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
include ActiveSupport::Testing::TimeHelpers
include StubENV
- let(:flaky_example_attrs) do
+ let(:example_attrs) do
{
example_id: 'spec/foo/bar_spec.rb:2',
file: 'spec/foo/bar_spec.rb',
line: 2,
description: 'hello world',
- first_flaky_at: 1234,
- last_flaky_at: 2345,
- last_flaky_job: 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/12',
last_attempts_count: 2,
- flaky_reports: 1
- }
- end
-
- let(:example_attrs) do
- {
- uid: 'abc123',
- example_id: flaky_example_attrs[:example_id],
- file: flaky_example_attrs[:file],
- line: flaky_example_attrs[:line],
- description: flaky_example_attrs[:description],
- status: 'passed',
- exception: 'BOOM!',
- attempts: flaky_example_attrs[:last_attempts_count]
+ feature_category: :feature_category
}
end
@@ -48,18 +32,19 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
it 'returns valid attributes' do
attrs = flaky_example.to_h
- expect(attrs[:uid]).to eq(flaky_example_attrs[:uid])
- expect(attrs[:file]).to eq(flaky_example_attrs[:file])
- expect(attrs[:line]).to eq(flaky_example_attrs[:line])
- expect(attrs[:description]).to eq(flaky_example_attrs[:description])
+ expect(attrs[:uid]).to eq(example_attrs[:uid])
+ expect(attrs[:file]).to eq(example_attrs[:file])
+ expect(attrs[:line]).to eq(example_attrs[:line])
+ expect(attrs[:description]).to eq(example_attrs[:description])
+ expect(attrs[:feature_category]).to eq(example_attrs[:feature_category])
expect(attrs[:first_flaky_at]).to eq(expected_first_flaky_at)
expect(attrs[:last_flaky_at]).to eq(expected_last_flaky_at)
- expect(attrs[:last_attempts_count]).to eq(flaky_example_attrs[:last_attempts_count])
+ expect(attrs[:last_attempts_count]).to eq(example_attrs[:last_attempts_count])
expect(attrs[:flaky_reports]).to eq(expected_flaky_reports)
end
end
- context 'when given an Example hash' do
+ context 'when given an Example.to_h' do
it_behaves_like 'a valid FlakyExample instance' do
let(:args) { example_attrs }
let(:expected_first_flaky_at) { Time.now }
@@ -67,18 +52,9 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
let(:expected_flaky_reports) { 0 }
end
end
-
- context 'when given a FlakyExample hash' do
- it_behaves_like 'a valid FlakyExample instance' do
- let(:args) { flaky_example_attrs }
- let(:expected_flaky_reports) { flaky_example_attrs[:flaky_reports] }
- let(:expected_first_flaky_at) { flaky_example_attrs[:first_flaky_at] }
- let(:expected_last_flaky_at) { flaky_example_attrs[:last_flaky_at] }
- end
- end
end
- describe '#update_flakiness!' do
+ describe '#update!' do
shared_examples 'an up-to-date FlakyExample instance' do
let(:flaky_example) { described_class.new(args) }
@@ -86,18 +62,18 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
args[:first_flaky_at] = nil
freeze_time do
- flaky_example.update_flakiness!
+ flaky_example.update!(example_attrs)
expect(flaky_example.to_h[:first_flaky_at]).to eq(Time.now)
end
end
it 'maintains the first_flaky_at if exists' do
- flaky_example.update_flakiness!
+ flaky_example.update!(example_attrs)
expected_first_flaky_at = flaky_example.to_h[:first_flaky_at]
travel_to(Time.now + 42) do
- flaky_example.update_flakiness!
+ flaky_example.update!(example_attrs)
expect(flaky_example.to_h[:first_flaky_at]).to eq(expected_first_flaky_at)
end
end
@@ -105,7 +81,7 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
it 'updates the last_flaky_at' do
travel_to(Time.now + 42) do
the_future = Time.now
- flaky_example.update_flakiness!
+ flaky_example.update!(example_attrs)
expect(flaky_example.to_h[:last_flaky_at]).to eq(the_future)
end
@@ -114,16 +90,15 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
it 'updates the flaky_reports' do
expected_flaky_reports = flaky_example.to_h[:first_flaky_at] ? flaky_example.to_h[:flaky_reports] + 1 : 1
- expect { flaky_example.update_flakiness! }.to change { flaky_example.to_h[:flaky_reports] }.by(1)
+ expect { flaky_example.update!(example_attrs) }.to change { flaky_example.to_h[:flaky_reports] }.by(1)
expect(flaky_example.to_h[:flaky_reports]).to eq(expected_flaky_reports)
end
- context 'when passed a :last_attempts_count' do
- it 'updates the last_attempts_count' do
- flaky_example.update_flakiness!(last_attempts_count: 42)
+ it 'updates the last_attempts_count' do
+ example_attrs[:last_attempts_count] = 42
+ flaky_example.update!(example_attrs)
- expect(flaky_example.to_h[:last_attempts_count]).to eq(42)
- end
+ expect(flaky_example.to_h[:last_attempts_count]).to eq(42)
end
context 'when run on the CI' do
@@ -134,7 +109,7 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
end
it 'updates the last_flaky_job' do
- flaky_example.update_flakiness!
+ flaky_example.update!(example_attrs)
expect(flaky_example.to_h[:last_flaky_job]).to eq(job_url)
end
@@ -146,12 +121,6 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
let(:args) { example_attrs }
end
end
-
- context 'when given a FlakyExample hash' do
- it_behaves_like 'an up-to-date FlakyExample instance' do
- let(:args) { flaky_example_attrs }
- end
- end
end
describe '#to_h', :freeze_time do
@@ -160,7 +129,7 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
it 'returns a valid hash' do
flaky_example = described_class.new(args)
- final_hash = flaky_example_attrs.merge(additional_attrs)
+ final_hash = example_attrs.merge(additional_attrs)
expect(flaky_example.to_h).to eq(final_hash)
end
@@ -175,11 +144,5 @@ RSpec.describe RspecFlaky::FlakyExample, :aggregate_failures do
end
end
end
-
- context 'when given a FlakyExample hash' do
- let(:args) { flaky_example_attrs }
-
- it_behaves_like 'a valid FlakyExample hash'
- end
end
end
diff --git a/spec/tooling/rspec_flaky/flaky_examples_collection_spec.rb b/spec/tooling/rspec_flaky/flaky_examples_collection_spec.rb
index e5f985c9596..9d75c97febe 100644
--- a/spec/tooling/rspec_flaky/flaky_examples_collection_spec.rb
+++ b/spec/tooling/rspec_flaky/flaky_examples_collection_spec.rb
@@ -20,6 +20,7 @@ RSpec.describe RspecFlaky::FlakyExamplesCollection, :aggregate_failures, :freeze
last_flaky_at: Time.now,
last_flaky_job: nil,
flaky_reports: 0,
+ feature_category: nil,
last_attempts_count: nil
},
b: {
@@ -28,6 +29,7 @@ RSpec.describe RspecFlaky::FlakyExamplesCollection, :aggregate_failures, :freeze
last_flaky_at: Time.now,
last_flaky_job: nil,
flaky_reports: 0,
+ feature_category: nil,
last_attempts_count: nil
}
}
@@ -69,6 +71,7 @@ RSpec.describe RspecFlaky::FlakyExamplesCollection, :aggregate_failures, :freeze
last_flaky_at: Time.now,
last_flaky_job: nil,
flaky_reports: 0,
+ feature_category: nil,
last_attempts_count: nil
})
end
diff --git a/spec/tooling/rspec_flaky/listener_spec.rb b/spec/tooling/rspec_flaky/listener_spec.rb
index 62bbe53cac1..0bbd6454969 100644
--- a/spec/tooling/rspec_flaky/listener_spec.rb
+++ b/spec/tooling/rspec_flaky/listener_spec.rb
@@ -128,6 +128,7 @@ RSpec.describe RspecFlaky::Listener, :aggregate_failures do
first_flaky_at: 1234,
last_attempts_count: 2,
flaky_reports: 2,
+ feature_category: nil,
last_flaky_job: nil
}
end
@@ -154,6 +155,7 @@ RSpec.describe RspecFlaky::Listener, :aggregate_failures do
description: 'hello GitLab',
last_attempts_count: 2,
flaky_reports: 1,
+ feature_category: nil,
last_flaky_job: nil
}
end
diff --git a/spec/tooling/rspec_flaky/report_spec.rb b/spec/tooling/rspec_flaky/report_spec.rb
index ffd0cd987aa..e7365c1e150 100644
--- a/spec/tooling/rspec_flaky/report_spec.rb
+++ b/spec/tooling/rspec_flaky/report_spec.rb
@@ -26,6 +26,7 @@ RSpec.describe RspecFlaky::Report, :aggregate_failures, :freeze_time do
last_flaky_at: 4321,
last_attempts_count: 3,
flaky_reports: 1,
+ feature_category: 'feature_category',
last_flaky_job: nil
}
}