Skip to content
Snippets Groups Projects
Commit cfff4ab8 authored by Bob Van Landuyt :neckbeard:'s avatar Bob Van Landuyt :neckbeard: :sunglasses:
Browse files

Merge branch 'eb-rename-ci-test-tables' into 'master'

Create new unit test tables

See merge request gitlab-org/gitlab!56137
parents fc6442e2 8a21dab1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,15 +11,15 @@
 
context 'when pipeline has failed builds with test reports' do
before do
# The test report has 2 test case failures
# The test report has 2 unit test failures
create(:ci_build, :failed, :test_reports, pipeline: pipeline, project: project)
end
 
it 'creates test case failures records' do
it 'creates unit test failures records' do
execute_service
 
expect(Ci::TestCase.count).to eq(2)
expect(Ci::TestCaseFailure.count).to eq(2)
expect(Ci::UnitTest.count).to eq(2)
expect(Ci::UnitTestFailure.count).to eq(2)
end
 
context 'when pipeline is not for the default branch' do
Loading
Loading
@@ -30,8 +30,8 @@
it 'does not persist data' do
execute_service
 
expect(Ci::TestCase.count).to eq(0)
expect(Ci::TestCaseFailure.count).to eq(0)
expect(Ci::UnitTest.count).to eq(0)
expect(Ci::UnitTestFailure.count).to eq(0)
end
end
 
Loading
Loading
@@ -43,12 +43,12 @@
it 'does not fail but does not persist new data' do
expect { described_class.new(pipeline).execute }.not_to raise_error
 
expect(Ci::TestCase.count).to eq(2)
expect(Ci::TestCaseFailure.count).to eq(2)
expect(Ci::UnitTest.count).to eq(2)
expect(Ci::UnitTestFailure.count).to eq(2)
end
end
 
context 'when number of failed test cases exceed the limit' do
context 'when number of failed unit tests exceed the limit' do
before do
stub_const("#{described_class.name}::MAX_TRACKABLE_FAILURES", 1)
end
Loading
Loading
@@ -56,16 +56,16 @@
it 'does not persist data' do
execute_service
 
expect(Ci::TestCase.count).to eq(0)
expect(Ci::TestCaseFailure.count).to eq(0)
expect(Ci::UnitTest.count).to eq(0)
expect(Ci::UnitTestFailure.count).to eq(0)
end
end
 
context 'when number of failed test cases across multiple builds exceed the limit' do
context 'when number of failed unit tests across multiple builds exceed the limit' do
before do
stub_const("#{described_class.name}::MAX_TRACKABLE_FAILURES", 2)
 
# This other test report has 1 unique test case failure which brings us to 3 total failures across all builds
# This other test report has 1 unique unit test failure which brings us to 3 total failures across all builds
# thus exceeding the limit of 2 for MAX_TRACKABLE_FAILURES
create(:ci_build, :failed, :test_reports_with_duplicate_failed_test_names, pipeline: pipeline, project: project)
end
Loading
Loading
@@ -73,23 +73,23 @@
it 'does not persist data' do
execute_service
 
expect(Ci::TestCase.count).to eq(0)
expect(Ci::TestCaseFailure.count).to eq(0)
expect(Ci::UnitTest.count).to eq(0)
expect(Ci::UnitTestFailure.count).to eq(0)
end
end
end
 
context 'when test failure data have duplicates within the same payload (happens when the JUnit report has duplicate test case names but have different failures)' do
context 'when test failure data have duplicates within the same payload (happens when the JUnit report has duplicate unit test names but have different failures)' do
before do
# The test report has 2 test case failures but with the same test case keys
# The test report has 2 unit test failures but with the same unit test keys
create(:ci_build, :failed, :test_reports_with_duplicate_failed_test_names, pipeline: pipeline, project: project)
end
 
it 'does not fail but does not persist duplicate data' do
expect { execute_service }.not_to raise_error
 
expect(Ci::TestCase.count).to eq(1)
expect(Ci::TestCaseFailure.count).to eq(1)
expect(Ci::UnitTest.count).to eq(1)
expect(Ci::UnitTestFailure.count).to eq(1)
end
end
 
Loading
Loading
@@ -102,8 +102,8 @@
it 'does not persist data' do
execute_service
 
expect(Ci::TestCase.count).to eq(0)
expect(Ci::TestCaseFailure.count).to eq(0)
expect(Ci::UnitTest.count).to eq(0)
expect(Ci::UnitTestFailure.count).to eq(0)
end
end
end
Loading
Loading
Loading
Loading
@@ -40,8 +40,8 @@
 
subject
 
expect(Ci::TestCase.count).to eq(2)
expect(Ci::TestCaseFailure.count).to eq(2)
expect(Ci::UnitTest.count).to eq(2)
expect(Ci::UnitTestFailure.count).to eq(2)
end
end
end
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