Skip to content
Snippets Groups Projects
Commit b84eeb25 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 53ae6b7e
No related branches found
No related tags found
No related merge requests found
Showing
with 656 additions and 44 deletions
Loading
Loading
@@ -78,12 +78,16 @@ module Gitlab
end
 
def max_threads
main_thread = 1
if puma?
Puma.cli_config.options[:max_threads]
Puma.cli_config.options[:max_threads] + main_thread
elsif sidekiq?
Sidekiq.options[:concurrency]
# An extra thread for the poller in Sidekiq Cron:
# https://github.com/ondrejbartas/sidekiq-cron#under-the-hood
Sidekiq.options[:concurrency] + main_thread + 1
else
1
main_thread
end
end
end
Loading
Loading
Loading
Loading
@@ -502,6 +502,9 @@ msgstr ""
msgid "'%{level}' is not a valid visibility level"
msgstr ""
 
msgid "'%{name}' stage already exists"
msgstr ""
msgid "'%{source}' is not a import source"
msgstr ""
 
Loading
Loading
@@ -6537,6 +6540,9 @@ msgstr ""
msgid "DesignManagement|Could not create new discussion. Please try again."
msgstr ""
 
msgid "DesignManagement|Could not update discussion. Please try again."
msgstr ""
msgid "DesignManagement|Delete"
msgstr ""
 
Loading
Loading
@@ -19338,6 +19344,9 @@ msgstr ""
msgid "There was a problem communicating with your device."
msgstr ""
 
msgid "There was a problem refreshing the data, please try again"
msgstr ""
msgid "There was a problem saving your custom stage, please try again"
msgstr ""
 
Loading
Loading
@@ -22394,6 +22403,9 @@ msgstr ""
msgid "Your comment could not be updated! Please check your network connection and try again."
msgstr ""
 
msgid "Your custom stage '%{title}' was created"
msgstr ""
msgid "Your dashboard has been copied. You can %{web_ide_link_start}edit it here%{web_ide_link_end}."
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,18 @@
 
FactoryBot.define do
factory :container_expiration_policy, class: 'ContainerExpirationPolicy' do
association :project, factory: [:project, :without_container_expiration_policy]
# Note: because of the project_id primary_key on
# container_expiration_policies, and the create_container_expiration_policy
# callback on Project, we need to build the project first before assigning
# it to a container_expiration_policy.
#
# Also, if you wish to assign an existing project to a
# container_expiration_policy, you will then have to destroy the project's
# container_expiration_policy first.
before(:create) do |container_expiration_policy|
container_expiration_policy.project = build(:project) unless container_expiration_policy.project
end
cadence { '1d' }
enabled { true }
 
Loading
Loading
Loading
Loading
@@ -140,12 +140,6 @@ FactoryBot.define do
end
end
 
trait :without_container_expiration_policy do
after(:build) do |project|
project.class.skip_callback(:create, :after, :create_container_expiration_policy, raise: false)
end
end
# Build a custom repository by specifying a hash of `filename => content` in
# the transient `files` attribute. Each file will be created in its own
# commit, operating against the master branch. So, the following call:
Loading
Loading
Loading
Loading
@@ -699,6 +699,137 @@ describe 'Merge request > User sees merge widget', :js do
end
end
 
context 'when a new error exists' do
let(:base_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
reports.get_suite('junit').add_test_case(create_test_case_java_success)
end
end
let(:head_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
reports.get_suite('junit').add_test_case(create_test_case_java_error)
end
end
it 'shows test reports summary which includes the new error' do
within(".js-reports-container") do
click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests')
within(".js-report-section-container") do
expect(page).to have_content('rspec found no changed test results out of 1 total test')
expect(page).to have_content('junit found 1 failed/error test result out of 1 total test')
expect(page).to have_content('New')
expect(page).to have_content('addTest')
end
end
end
context 'when user clicks the new error' do
it 'shows the test report detail' do
within(".js-reports-container") do
click_button 'Expand'
within(".js-report-section-container") do
click_button 'addTest'
expect(page).to have_content('8.88')
end
end
end
end
end
context 'when an existing error exists' do
let(:base_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_error)
reports.get_suite('junit').add_test_case(create_test_case_java_success)
end
end
let(:head_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_error)
reports.get_suite('junit').add_test_case(create_test_case_java_success)
end
end
it 'shows test reports summary which includes the existing error' do
within(".js-reports-container") do
click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests')
within(".js-report-section-container") do
expect(page).to have_content('rspec found 1 failed/error test result out of 1 total test')
expect(page).to have_content('junit found no changed test results out of 1 total test')
expect(page).not_to have_content('New')
expect(page).to have_content('Test#sum when a is 4 and b is 4 returns summary')
end
end
end
context 'when user clicks the existing error' do
it 'shows test report detail of it' do
within(".js-reports-container") do
click_button 'Expand'
within(".js-report-section-container") do
click_button 'Test#sum when a is 4 and b is 4 returns summary'
expect(page).to have_content('4.44')
end
end
end
end
end
context 'when a resolved error exists' do
let(:base_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
reports.get_suite('junit').add_test_case(create_test_case_java_error)
end
end
let(:head_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
reports.get_suite('junit').add_test_case(create_test_case_java_success)
end
end
it 'shows test reports summary which includes the resolved error' do
within(".js-reports-container") do
click_button 'Expand'
expect(page).to have_content('Test summary contained 1 fixed test result out of 2 total tests')
within(".js-report-section-container") do
expect(page).to have_content('rspec found no changed test results out of 1 total test')
expect(page).to have_content('junit found 1 fixed test result out of 1 total test')
expect(page).to have_content('addTest')
end
end
end
context 'when user clicks the resolved error' do
it 'shows test report detail of it' do
within(".js-reports-container") do
click_button 'Expand'
within(".js-report-section-container") do
click_button 'addTest'
expect(page).to have_content('5.55')
end
end
end
end
end
context 'properly truncates the report' do
let(:base_reports) do
Gitlab::Ci::Reports::TestReports.new.tap do |reports|
Loading
Loading
Loading
Loading
@@ -10,7 +10,6 @@ describe 'Project > Settings > CI/CD > Container registry tag expiration policy'
before do
sign_in(user)
stub_container_registry_config(enabled: true)
stub_feature_flags(registry_retention_policies_settings: true)
end
 
context 'as owner' do
Loading
Loading
@@ -63,15 +62,4 @@ describe 'Project > Settings > CI/CD > Container registry tag expiration policy'
expect(page).not_to have_selector('#js-registry-policies')
end
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(registry_retention_policies_settings: false)
visit project_settings_ci_cd_path(project)
end
it 'does not exists' do
expect(page).not_to have_selector('#js-registry-policies')
end
end
end
Loading
Loading
@@ -12,11 +12,13 @@
"properties": {
"total": { "type": "integer" },
"resolved": { "type": "integer" },
"errored": { "type": "integer" },
"failed": { "type": "integer" }
},
"required": [
"total",
"resolved",
"errored",
"failed"
]
},
Loading
Loading
Loading
Loading
@@ -16,17 +16,17 @@
"properties": {
"total": { "type": "integer" },
"resolved": { "type": "integer" },
"errored": { "type": "integer" },
"failed": { "type": "integer" }
},
"required": [
"total",
"resolved",
"failed"
]
"required": ["total", "resolved", "errored", "failed"]
},
"new_failures": { "type": "array", "items": { "$ref": "test_case.json" } },
"resolved_failures": { "type": "array", "items": { "$ref": "test_case.json" } },
"existing_failures": { "type": "array", "items": { "$ref": "test_case.json" } }
"existing_failures": { "type": "array", "items": { "$ref": "test_case.json" } },
"new_errors": { "type": "array", "items": { "$ref": "test_case.json" } },
"resolved_errors": { "type": "array", "items": { "$ref": "test_case.json" } },
"existing_errors": { "type": "array", "items": { "$ref": "test_case.json" } }
},
"additionalProperties": false
}
Loading
Loading
@@ -122,6 +122,10 @@ describe('Issuable component', () => {
expect(finder().exists()).toBe(false);
});
 
it('show relative reference path', () => {
expect(wrapper.find('.js-ref-path').text()).toBe(issuable.references.relative);
});
it('does not have closed text', () => {
expect(wrapper.text()).not.toContain(TEXT_CLOSED);
});
Loading
Loading
Loading
Loading
@@ -26,6 +26,9 @@ export const simpleIssue = {
web_url: 'http://localhost:3001/h5bp/html5-boilerplate/issues/31',
has_tasks: false,
weight: null,
references: {
relative: 'html-boilerplate#45',
},
};
 
export const testLabels = [
Loading
Loading
Loading
Loading
@@ -35,6 +35,16 @@ describe('Reports store utils', () => {
);
});
 
it('should render text for multiple errored results', () => {
const name = 'Test summary';
const data = { errored: 7, total: 10 };
const result = utils.summaryTextBuilder(name, data);
expect(result).toBe(
'Test summary contained 7 failed/error test results out of 10 total tests',
);
});
it('should render text for multiple fixed results', () => {
const name = 'Test summary';
const data = { resolved: 4, total: 10 };
Loading
Loading
@@ -62,6 +72,27 @@ describe('Reports store utils', () => {
'Test summary contained 1 failed/error test result and 1 fixed test result out of 10 total tests',
);
});
it('should render text for singular failed, errored, and fixed results', () => {
// these will be singular when the copy is updated
const name = 'Test summary';
const data = { failed: 1, errored: 1, resolved: 1, total: 10 };
const result = utils.summaryTextBuilder(name, data);
expect(result).toBe(
'Test summary contained 2 failed/error test results and 1 fixed test result out of 10 total tests',
);
});
it('should render text for multiple failed, errored, and fixed results', () => {
const name = 'Test summary';
const data = { failed: 2, errored: 3, resolved: 4, total: 10 };
const result = utils.summaryTextBuilder(name, data);
expect(result).toBe(
'Test summary contained 5 failed/error test results and 4 fixed test results out of 10 total tests',
);
});
});
 
describe('reportTextBuilder', () => {
Loading
Loading
@@ -89,6 +120,14 @@ describe('Reports store utils', () => {
expect(result).toBe('Rspec found 3 failed/error test results out of 10 total tests');
});
 
it('should render text for multiple errored results', () => {
const name = 'Rspec';
const data = { errored: 7, total: 10 };
const result = utils.reportTextBuilder(name, data);
expect(result).toBe('Rspec found 7 failed/error test results out of 10 total tests');
});
it('should render text for multiple fixed results', () => {
const name = 'Rspec';
const data = { resolved: 4, total: 10 };
Loading
Loading
@@ -116,6 +155,27 @@ describe('Reports store utils', () => {
'Rspec found 1 failed/error test result and 1 fixed test result out of 10 total tests',
);
});
it('should render text for singular failed, errored, and fixed results', () => {
// these will be singular when the copy is updated
const name = 'Rspec';
const data = { failed: 1, errored: 1, resolved: 1, total: 10 };
const result = utils.reportTextBuilder(name, data);
expect(result).toBe(
'Rspec found 2 failed/error test results and 1 fixed test result out of 10 total tests',
);
});
it('should render text for multiple failed, errored, and fixed results', () => {
const name = 'Rspec';
const data = { failed: 2, errored: 3, resolved: 4, total: 10 };
const result = utils.reportTextBuilder(name, data);
expect(result).toBe(
'Rspec found 5 failed/error test results and 4 fixed test results out of 10 total tests',
);
});
});
 
describe('statusIcon', () => {
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ import state from '~/reports/store/state';
import component from '~/reports/components/grouped_test_reports_app.vue';
import mountComponent from '../../helpers/vue_mount_component_helper';
import newFailedTestReports from '../mock_data/new_failures_report.json';
import newErrorsTestReports from '../mock_data/new_errors_report.json';
import successTestReports from '../mock_data/no_failures_report.json';
import mixedResultsTestReports from '../mock_data/new_and_fixed_failures_report.json';
import resolvedFailures from '../mock_data/resolved_failures.json';
Loading
Loading
@@ -99,6 +100,34 @@ describe('Grouped Test Reports App', () => {
});
});
 
describe('with new error result', () => {
beforeEach(() => {
mock.onGet('test_results.json').reply(200, newErrorsTestReports, {});
vm = mountComponent(Component, {
endpoint: 'test_results.json',
});
});
it('renders error summary text + new badge', done => {
setTimeout(() => {
expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed/error test results out of 11 total tests',
);
expect(vm.$el.textContent).toContain(
'karma found 2 failed/error test results out of 3 total tests',
);
expect(vm.$el.textContent).toContain('New');
expect(vm.$el.textContent).toContain(
'rspec:pg found no changed test results out of 8 total tests',
);
done();
}, 0);
});
});
describe('with mixed results', () => {
beforeEach(() => {
mock.onGet('test_results.json').reply(200, mixedResultsTestReports, {});
Loading
Loading
@@ -127,7 +156,7 @@ describe('Grouped Test Reports App', () => {
});
});
 
describe('with resolved failures', () => {
describe('with resolved failures and resolved errors', () => {
beforeEach(() => {
mock.onGet('test_results.json').reply(200, resolvedFailures, {});
vm = mountComponent(Component, {
Loading
Loading
@@ -139,11 +168,11 @@ describe('Grouped Test Reports App', () => {
setTimeout(() => {
expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 fixed test results out of 11 total tests',
'Test summary contained 4 fixed test results out of 11 total tests',
);
 
expect(vm.$el.textContent).toContain(
'rspec:pg found 2 fixed test results out of 8 total tests',
'rspec:pg found 4 fixed test results out of 8 total tests',
);
done();
}, 0);
Loading
Loading
@@ -161,6 +190,19 @@ describe('Grouped Test Reports App', () => {
done();
}, 0);
});
it('renders resolved errors', done => {
setTimeout(() => {
expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
resolvedFailures.suites[0].resolved_errors[0].name,
);
expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
resolvedFailures.suites[0].resolved_errors[1].name,
);
done();
}, 0);
});
});
 
describe('with error', () => {
Loading
Loading
{"status":"failed","summary":{"total":11,"resolved":2,"failed":2},"suites":[{"name":"rspec:pg","status":"failed","summary":{"total":8,"resolved":2,"failed":1},"new_failures":[{"status":"failed","name":"Test#subtract when a is 2 and b is 1 returns correct result","execution_time":0.00908,"system_output":"Failure/Error: is_expected.to eq(1)\n\n expected: 1\n got: 3\n\n (compared using ==)\n./spec/test_spec.rb:43:in `block (4 levels) in <top (required)>'"}],"resolved_failures":[{"status":"success","name":"Test#sum when a is 1 and b is 2 returns summary","execution_time":0.000318,"system_output":null},{"status":"success","name":"Test#sum when a is 100 and b is 200 returns summary","execution_time":0.000074,"system_output":null}],"existing_failures":[]},{"name":"java ant","status":"failed","summary":{"total":3,"resolved":0,"failed":1},"new_failures":[],"resolved_failures":[],"existing_failures":[{"status":"failed","name":"sumTest","execution_time":0.004,"system_output":"junit.framework.AssertionFailedError: expected:<3> but was:<-1>\n\tat CalculatorTest.sumTest(Unknown Source)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n"}]}]}
\ No newline at end of file
{
"status": "failed",
"summary": { "total": 11, "resolved": 2, "errored": 0, "failed": 2 },
"suites": [
{
"name": "rspec:pg",
"status": "failed",
"summary": { "total": 8, "resolved": 2, "errored": 0, "failed": 1 },
"new_failures": [
{
"status": "failed",
"name": "Test#subtract when a is 2 and b is 1 returns correct result",
"execution_time": 0.00908,
"system_output": "Failure/Error: is_expected.to eq(1)\n\n expected: 1\n got: 3\n\n (compared using ==)\n./spec/test_spec.rb:43:in `block (4 levels) in <top (required)>'"
}
],
"resolved_failures": [
{
"status": "success",
"name": "Test#sum when a is 1 and b is 2 returns summary",
"execution_time": 0.000318,
"system_output": null
},
{
"status": "success",
"name": "Test#sum when a is 100 and b is 200 returns summary",
"execution_time": 0.000074,
"system_output": null
}
],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
},
{
"name": "java ant",
"status": "failed",
"summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 1 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [
{
"status": "failed",
"name": "sumTest",
"execution_time": 0.004,
"system_output": "junit.framework.AssertionFailedError: expected:<3> but was:<-1>\n\tat CalculatorTest.sumTest(Unknown Source)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n"
}
],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
}
]
}
{
"summary": { "total": 11, "resolved": 0, "errored": 2, "failed": 0 },
"suites": [
{
"name": "rspec:pg",
"summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
},
{
"name": "karma",
"summary": { "total": 3, "resolved": 0, "errored": 2, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [
{
"result": "error",
"name": "Test#sum when a is 1 and b is 2 returns summary",
"execution_time": 0.009411,
"system_output": "Failed: Error in render: 'TypeError: Cannot read property 'status' of undefined'"
},
{
"result": "error",
"name": "Test#sum when a is 100 and b is 200 returns summary",
"execution_time": 0.000162,
"system_output": "Failed: Error in render: 'TypeError: Cannot read property 'length' of undefined'"
}
],
"resolved_errors": [],
"existing_errors": []
}
]
}
{"summary":{"total":11,"resolved":0,"failed":2},"suites":[{"name":"rspec:pg","summary":{"total":8,"resolved":0,"failed":2},"new_failures":[{"result":"failure","name":"Test#sum when a is 1 and b is 2 returns summary","execution_time":0.009411,"system_output":"Failure/Error: is_expected.to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/test_spec.rb:12:in `block (4 levels) in <top (required)>'"},{"result":"failure","name":"Test#sum when a is 100 and b is 200 returns summary","execution_time":0.000162,"system_output":"Failure/Error: is_expected.to eq(300)\n\n expected: 300\n got: -100\n\n (compared using ==)\n./spec/test_spec.rb:21:in `block (4 levels) in <top (required)>'"}],"resolved_failures":[],"existing_failures":[]},{"name":"java ant","summary":{"total":3,"resolved":0,"failed":0},"new_failures":[],"resolved_failures":[],"existing_failures":[]}]}
\ No newline at end of file
{
"summary": { "total": 11, "resolved": 0, "errored": 0, "failed": 2 },
"suites": [
{
"name": "rspec:pg",
"summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 2 },
"new_failures": [
{
"result": "failure",
"name": "Test#sum when a is 1 and b is 2 returns summary",
"execution_time": 0.009411,
"system_output": "Failure/Error: is_expected.to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/test_spec.rb:12:in `block (4 levels) in <top (required)>'"
},
{
"result": "failure",
"name": "Test#sum when a is 100 and b is 200 returns summary",
"execution_time": 0.000162,
"system_output": "Failure/Error: is_expected.to eq(300)\n\n expected: 300\n got: -100\n\n (compared using ==)\n./spec/test_spec.rb:21:in `block (4 levels) in <top (required)>'"
}
],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
},
{
"name": "java ant",
"summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
}
]
}
{"status":"success","summary":{"total":11,"resolved":0,"failed":0},"suites":[{"name":"rspec:pg","status":"success","summary":{"total":8,"resolved":0,"failed":0},"new_failures":[],"resolved_failures":[],"existing_failures":[]},{"name":"java ant","status":"success","summary":{"total":3,"resolved":0,"failed":0},"new_failures":[],"resolved_failures":[],"existing_failures":[]}]}
\ No newline at end of file
{
"status": "success",
"summary": { "total": 11, "resolved": 0, "errored": 0, "failed": 0 },
"suites": [
{
"name": "rspec:pg",
"status": "success",
"summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
},
{
"name": "java ant",
"status": "success",
"summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
}
]
}
{
"status": "success",
"summary": { "total": 11, "resolved": 2, "failed": 0 },
"summary": { "total": 11, "resolved": 4, "errored": 0, "failed": 0 },
"suites": [
{
"name": "rspec:pg",
"status": "success",
"summary": { "total": 8, "resolved": 2, "failed": 0 },
"summary": { "total": 8, "resolved": 4, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [
{
Loading
Loading
@@ -23,15 +23,36 @@
"stack_trace": null
}
],
"existing_failures": []
"existing_failures": [],
"new_errors": [],
"resolved_errors": [
{
"status": "success",
"name": "Test#sum when a is 4 and b is 4 returns summary",
"execution_time": 0.00342,
"system_output": null,
"stack_trace": null
},
{
"status": "success",
"name": "Test#sum when a is 40 and b is 400 returns summary",
"execution_time": 0.0000231,
"system_output": null,
"stack_trace": null
}
],
"existing_errors": []
},
{
"name": "java ant",
"status": "success",
"summary": { "total": 3, "resolved": 0, "failed": 0 },
"summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
"new_failures": [],
"resolved_failures": [],
"existing_failures": []
"existing_failures": [],
"new_errors": [],
"resolved_errors": [],
"existing_errors": []
}
]
}
Loading
Loading
@@ -99,7 +99,7 @@ describe Gitlab::Ci::Parsers::Test::Junit do
let(:testcase_content) { '<error>Some error</error>' }
 
it_behaves_like '<testcase> XML parser',
::Gitlab::Ci::Reports::TestCase::STATUS_FAILED,
::Gitlab::Ci::Reports::TestCase::STATUS_ERROR,
'Some error'
end
 
Loading
Loading
Loading
Loading
@@ -57,6 +57,17 @@ describe Gitlab::Ci::Reports::TestReportsComparer do
is_expected.to eq(Gitlab::Ci::Reports::TestCase::STATUS_FAILED)
end
end
context 'when there is an error test case in head suites' do
before do
head_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
head_reports.get_suite('junit').add_test_case(create_test_case_java_error)
end
it 'returns the total status in head suite' do
is_expected.to eq(Gitlab::Ci::Reports::TestCase::STATUS_FAILED)
end
end
end
 
describe '#total_count' do
Loading
Loading
@@ -75,7 +86,7 @@ describe Gitlab::Ci::Reports::TestReportsComparer do
describe '#resolved_count' do
subject { comparer.resolved_count }
 
context 'when there is a resolved test case in head suites' do
context 'when there is a resolved failure test case in head suites' do
before do
base_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
base_reports.get_suite('junit').add_test_case(create_test_case_java_failed)
Loading
Loading
@@ -88,6 +99,19 @@ describe Gitlab::Ci::Reports::TestReportsComparer do
end
end
 
context 'when there is a resolved error test case in head suites' do
before do
base_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
base_reports.get_suite('junit').add_test_case(create_test_case_java_error)
head_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
head_reports.get_suite('junit').add_test_case(create_test_case_java_success)
end
it 'returns the correct count' do
is_expected.to eq(1)
end
end
context 'when there are no resolved test cases in head suites' do
before do
base_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
Loading
Loading
@@ -127,4 +151,30 @@ describe Gitlab::Ci::Reports::TestReportsComparer do
end
end
end
describe '#error_count' do
subject { comparer.error_count }
context 'when there is an error test case in head suites' do
before do
head_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
head_reports.get_suite('junit').add_test_case(create_test_case_java_error)
end
it 'returns the correct count' do
is_expected.to eq(1)
end
end
context 'when there are no error test cases in head suites' do
before do
head_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success)
head_reports.get_suite('junit').add_test_case(create_test_case_rspec_success)
end
it 'returns the correct count' do
is_expected.to eq(0)
end
end
end
end
Loading
Loading
@@ -9,8 +9,9 @@ describe Gitlab::Ci::Reports::TestSuiteComparer do
let(:name) { 'rpsec' }
let(:base_suite) { Gitlab::Ci::Reports::TestSuite.new(name) }
let(:head_suite) { Gitlab::Ci::Reports::TestSuite.new(name) }
let(:test_case_success) { create_test_case_rspec_success }
let(:test_case_failed) { create_test_case_rspec_failed }
let(:test_case_success) { create_test_case_java_success }
let(:test_case_failed) { create_test_case_java_failed }
let(:test_case_error) { create_test_case_java_error }
 
describe '#new_failures' do
subject { comparer.new_failures }
Loading
Loading
@@ -135,6 +136,129 @@ describe Gitlab::Ci::Reports::TestSuiteComparer do
end
end
 
describe '#new_errors' do
subject { comparer.new_errors }
context 'when head suite has a new error test case which does not exist in base' do
before do
base_suite.add_test_case(test_case_success)
head_suite.add_test_case(test_case_error)
end
it 'returns the error test case' do
is_expected.to eq([test_case_error])
end
end
context 'when head suite still has an error test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_error)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
end
context 'when head suite has a success test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_success)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
end
end
describe '#existing_errors' do
subject { comparer.existing_errors }
context 'when head suite has a new error test case which does not exist in base' do
before do
base_suite.add_test_case(test_case_success)
head_suite.add_test_case(test_case_error)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
end
context 'when head suite still has an error test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_error)
end
it 'returns the error test case' do
is_expected.to eq([test_case_error])
end
end
context 'when head suite has a success test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_success)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
end
end
describe '#resolved_errors' do
subject { comparer.resolved_errors }
context 'when head suite has a new error test case which does not exist in base' do
before do
base_suite.add_test_case(test_case_success)
head_suite.add_test_case(test_case_error)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
it 'returns the correct resolved count' do
expect(comparer.resolved_count).to eq(0)
end
end
context 'when head suite still has an error test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_error)
end
it 'does not return the error test case' do
is_expected.to be_empty
end
it 'returns the correct resolved count' do
expect(comparer.resolved_count).to eq(0)
end
end
context 'when head suite has a success test case which errored in base' do
before do
base_suite.add_test_case(test_case_error)
head_suite.add_test_case(test_case_success)
end
it 'returns the resolved test case' do
is_expected.to eq([test_case_success])
end
it 'returns the correct resolved count' do
expect(comparer.resolved_count).to eq(1)
end
end
end
describe '#total_count' do
subject { comparer.total_count }
 
Loading
Loading
@@ -208,7 +332,17 @@ describe Gitlab::Ci::Reports::TestSuiteComparer do
head_suite.add_test_case(test_case_failed)
end
 
it 'returns the total status in head suite' do
it 'returns the total status in head suite as failed' do
is_expected.to eq(Gitlab::Ci::Reports::TestCase::STATUS_FAILED)
end
end
context 'when there is an error test case in head suite' do
before do
head_suite.add_test_case(test_case_error)
end
it 'returns the total status in head suite as failed' do
is_expected.to eq(Gitlab::Ci::Reports::TestCase::STATUS_FAILED)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment