Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle new flake model #958

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Conversation

joseph-sentry
Copy link
Contributor

No description provided.

@codecov-staging
Copy link

codecov-staging bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
database/models/reports.py 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Dec 13, 2024

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
1764 3 1761 1
View the top 3 failed tests by shortest run time
tasks/tests/unit/test_test_results_processor_task.py::TestUploadTestProcessorTask::test_upload_processor_task_call_daily_test_totals
Stack Traces | 0.106s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f083c282a50>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f08379eac90>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f083c853970; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (3, null, null, 0, 0, 0, 2024-12-13 20:09:21.548953+00, null, null, 135, 61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_processor_task.TestUploadTestProcessorTask object at 0x7f083e1ca4b0>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f08379ebda0>
mock_configuration = <shared.config.ConfigHelper object at 0x7f08379e8980>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f08379eb950>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f08379eb9b0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f083c59cbc0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673354341504'>
celery_app = <Celery celery.tests at 0x7f083c1bbf80>

    @pytest.mark.integration
    def test_upload_processor_task_call_daily_test_totals(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
    ):
        with travel("1970-1-1T00:00:00Z", tick=False):
            first_url = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/a84d445c-9c1e-434f-8275-f18f1f320f81.txt"
            with open(
                here.parent.parent / "samples" / "sample_multi_test_part_1.json"
            ) as f:
                content = f.read()
                mock_storage.write_file("archive", first_url, content)
    
            first_commit = CommitFactory.create(
                message="hello world",
                commitid="cd76b0821854a780b60012aed85af0a8263004ad",
                repository__owner__unencrypted_oauth_token="test7lk5ndmtqzxlx06rip65nac9c7epqopclnoy",
                repository__owner__username="joseph-sentry",
                repository__owner__service="github",
                repository__name="codecov-demo",
                branch="first_branch",
            )
            dbsession.add(first_commit)
            dbsession.flush()
    
            first_report_row = CommitReport(commit_id=first_commit.id_)
            dbsession.add(first_report_row)
            dbsession.flush()
    
            upload = UploadFactory.create(
                storage_path=first_url, report=first_report_row
            )
            dbsession.add(upload)
            dbsession.flush()
    
            repoid = upload.report.commit.repoid
            redis_queue = [{"url": first_url, "upload_id": upload.id_}]
            mocker.patch.object(TestResultsProcessorTask, "app", celery_app)
    
            result = TestResultsProcessorTask().run_impl(
                dbsession,
                repoid=repoid,
                commitid=first_commit.commitid,
                commit_yaml={"codecov": {"max_report_age": False}},
                arguments_list=redis_queue,
            )
            expected_result = [
                {
                    "successful": True,
                }
            ]
    
            rollups = dbsession.query(DailyTestRollup).all()
    
            assert [r.branch for r in rollups] == [
                "first_branch",
                "first_branch",
            ]
    
            assert [r.date for r in rollups] == [
                date.today(),
                date.today(),
            ]
    
        with travel("1970-1-2T00:00:00Z", tick=False):
            second_commit = CommitFactory.create(
                message="hello world 2",
                commitid="bd76b0821854a780b60012aed85af0a8263004ad",
                repository=first_commit.repository,
                branch="second_branch",
            )
            dbsession.add(second_commit)
            dbsession.flush()
    
            second_report_row = CommitReport(commit_id=second_commit.id_)
            dbsession.add(second_report_row)
            dbsession.flush()
    
            second_url = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/b84d445c-9c1e-434f-8275-f18f1f320f81.txt"
            with open(
                here.parent.parent / "samples" / "sample_multi_test_part_2.json"
            ) as f:
                content = f.read()
                mock_storage.write_file("archive", second_url, content)
            upload = UploadFactory.create(
                storage_path=second_url, report=second_report_row
            )
            dbsession.add(upload)
            dbsession.flush()
    
            tests = dbsession.query(Test).all()
            for test in tests:
                flake = FlakeFactory.create(test=test)
                dbsession.add(flake)
>               dbsession.flush()

.../tests/unit/test_test_results_processor_task.py:583: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f083c853970; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (3, null, null, 0, 0, 0, 2024-12-13 20:09:21.548953+00, null, null, 135, 61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 135, 'testid': '61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc', 'reduced_error_id': None, 'recent_passes_count': 0, 'count': 0, 'fail_count': 0, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 21, 548953), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
tasks/tests/unit/test_test_results_finisher.py::TestUploadTestFinisherTask::test_upload_finisher_task_call_with_flaky[50-150-10]
Stack Traces | 0.18s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f081d69caa0>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f083c11e000>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f0837731120; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (2, null, null, 10, 150, 50, 2024-12-13 20:09:50.542373+00, null, 2, 103, 9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_finisher.TestUploadTestFinisherTask object at 0x7f083e117980>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f08342c3200>
mock_configuration = <shared.config.ConfigHelper object at 0x7f083c11f8f0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f083c11ede0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f083c11e570>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f083c77e4b0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673350947328'>
celery_app = <Celery celery.tests at 0x7f083c77c470>
test_results_mock_app = <MagicMock name='app' id='139673211520112'>
mock_repo_provider_comments = <MagicMock id='139673350096608'>
test_results_setup = (103, Commit<cd76b0821854a780b60012aed85af0a8263004ad@repo<103>>, Pull<47@repo<103>>, [<database.models.reports.TestIn...odels.reports.TestInstance object at 0x7f081d6a69f0>, <database.models.reports.TestInstance object at 0x7f081d6a7410>])
fail_count = 50, count = 150, recent_passes_count = 10

    @pytest.mark.parametrize(
        "fail_count,count,recent_passes_count", [(2, 15, 13), (50, 150, 10)]
    )
    @pytest.mark.integration
    def test_upload_finisher_task_call_with_flaky(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
        test_results_mock_app,
        mock_repo_provider_comments,
        test_results_setup,
        fail_count,
        count,
        recent_passes_count,
    ):
        mock_feature = mocker.patch("services.test_results.FLAKY_TEST_DETECTION")
        mock_feature.check_value.return_value = True
    
        repoid, commit, pull, test_instances = test_results_setup
    
        for i, instance in enumerate(test_instances):
            if i != 2:
                dbsession.delete(instance)
        dbsession.flush()
    
        r = ReducedError()
        r.message = "failure_message"
    
        dbsession.add(r)
        dbsession.flush()
    
        f = Flake()
        f.repoid = repoid
        f.testid = test_instances[2].test_id
        f.reduced_error = r
        f.count = count
        f.fail_count = fail_count
        f.recent_passes_count = recent_passes_count
        f.start_date = datetime.now()
        f.end_date = None
    
        dbsession.add(f)
>       dbsession.flush()

.../tests/unit/test_test_results_finisher.py:881: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f0837731120; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (2, null, null, 10, 150, 50, 2024-12-13 20:09:50.542373+00, null, 2, 103, 9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 103, 'testid': '9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb', 'reduced_error_id': 2, 'recent_passes_count': 10, 'count': 150, 'fail_count': 50, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 50, 542373), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
tasks/tests/unit/test_test_results_finisher.py::TestUploadTestFinisherTask::test_upload_finisher_task_call_with_flaky[2-15-13]
Stack Traces | 0.181s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f08342a42f0>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f08342aaae0>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f08377323e0; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (1, null, null, 13, 15, 2, 2024-12-13 20:09:50.161754+00, null, 1, 98, 04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_finisher.TestUploadTestFinisherTask object at 0x7f083e117770>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f083c77f590>
mock_configuration = <shared.config.ConfigHelper object at 0x7f08342a8a10>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f08342aa840>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f0837a1d9a0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f08342a4200>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673346157760'>
celery_app = <Celery celery.tests at 0x7f083c11e270>
test_results_mock_app = <MagicMock name='app' id='139673211777392'>
mock_repo_provider_comments = <MagicMock id='139673344264624'>
test_results_setup = (98, Commit<cd76b0821854a780b60012aed85af0a8263004ad@repo<98>>, Pull<40@repo<98>>, [<database.models.reports.TestInsta...odels.reports.TestInstance object at 0x7f08342d26c0>, <database.models.reports.TestInstance object at 0x7f08342a4890>])
fail_count = 2, count = 15, recent_passes_count = 13

    @pytest.mark.parametrize(
        "fail_count,count,recent_passes_count", [(2, 15, 13), (50, 150, 10)]
    )
    @pytest.mark.integration
    def test_upload_finisher_task_call_with_flaky(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
        test_results_mock_app,
        mock_repo_provider_comments,
        test_results_setup,
        fail_count,
        count,
        recent_passes_count,
    ):
        mock_feature = mocker.patch("services.test_results.FLAKY_TEST_DETECTION")
        mock_feature.check_value.return_value = True
    
        repoid, commit, pull, test_instances = test_results_setup
    
        for i, instance in enumerate(test_instances):
            if i != 2:
                dbsession.delete(instance)
        dbsession.flush()
    
        r = ReducedError()
        r.message = "failure_message"
    
        dbsession.add(r)
        dbsession.flush()
    
        f = Flake()
        f.repoid = repoid
        f.testid = test_instances[2].test_id
        f.reduced_error = r
        f.count = count
        f.fail_count = fail_count
        f.recent_passes_count = recent_passes_count
        f.start_date = datetime.now()
        f.end_date = None
    
        dbsession.add(f)
>       dbsession.flush()

.../tests/unit/test_test_results_finisher.py:881: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f08377323e0; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (1, null, null, 13, 15, 2, 2024-12-13 20:09:50.161754+00, null, 1, 98, 04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 98, 'testid': '04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb', 'reduced_error_id': 1, 'recent_passes_count': 13, 'count': 15, 'fail_count': 2, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 50, 161754), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
1764 3 1761 1
View the top 3 failed tests by shortest run time
tasks/tests/unit/test_test_results_processor_task.py::TestUploadTestProcessorTask::test_upload_processor_task_call_daily_test_totals
Stack Traces | 0.106s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f083c282a50>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f08379eac90>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f083c853970; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (3, null, null, 0, 0, 0, 2024-12-13 20:09:21.548953+00, null, null, 135, 61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_processor_task.TestUploadTestProcessorTask object at 0x7f083e1ca4b0>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f08379ebda0>
mock_configuration = <shared.config.ConfigHelper object at 0x7f08379e8980>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f08379eb950>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f08379eb9b0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f083c59cbc0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673354341504'>
celery_app = <Celery celery.tests at 0x7f083c1bbf80>

    @pytest.mark.integration
    def test_upload_processor_task_call_daily_test_totals(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
    ):
        with travel("1970-1-1T00:00:00Z", tick=False):
            first_url = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/a84d445c-9c1e-434f-8275-f18f1f320f81.txt"
            with open(
                here.parent.parent / "samples" / "sample_multi_test_part_1.json"
            ) as f:
                content = f.read()
                mock_storage.write_file("archive", first_url, content)
    
            first_commit = CommitFactory.create(
                message="hello world",
                commitid="cd76b0821854a780b60012aed85af0a8263004ad",
                repository__owner__unencrypted_oauth_token="test7lk5ndmtqzxlx06rip65nac9c7epqopclnoy",
                repository__owner__username="joseph-sentry",
                repository__owner__service="github",
                repository__name="codecov-demo",
                branch="first_branch",
            )
            dbsession.add(first_commit)
            dbsession.flush()
    
            first_report_row = CommitReport(commit_id=first_commit.id_)
            dbsession.add(first_report_row)
            dbsession.flush()
    
            upload = UploadFactory.create(
                storage_path=first_url, report=first_report_row
            )
            dbsession.add(upload)
            dbsession.flush()
    
            repoid = upload.report.commit.repoid
            redis_queue = [{"url": first_url, "upload_id": upload.id_}]
            mocker.patch.object(TestResultsProcessorTask, "app", celery_app)
    
            result = TestResultsProcessorTask().run_impl(
                dbsession,
                repoid=repoid,
                commitid=first_commit.commitid,
                commit_yaml={"codecov": {"max_report_age": False}},
                arguments_list=redis_queue,
            )
            expected_result = [
                {
                    "successful": True,
                }
            ]
    
            rollups = dbsession.query(DailyTestRollup).all()
    
            assert [r.branch for r in rollups] == [
                "first_branch",
                "first_branch",
            ]
    
            assert [r.date for r in rollups] == [
                date.today(),
                date.today(),
            ]
    
        with travel("1970-1-2T00:00:00Z", tick=False):
            second_commit = CommitFactory.create(
                message="hello world 2",
                commitid="bd76b0821854a780b60012aed85af0a8263004ad",
                repository=first_commit.repository,
                branch="second_branch",
            )
            dbsession.add(second_commit)
            dbsession.flush()
    
            second_report_row = CommitReport(commit_id=second_commit.id_)
            dbsession.add(second_report_row)
            dbsession.flush()
    
            second_url = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/b84d445c-9c1e-434f-8275-f18f1f320f81.txt"
            with open(
                here.parent.parent / "samples" / "sample_multi_test_part_2.json"
            ) as f:
                content = f.read()
                mock_storage.write_file("archive", second_url, content)
            upload = UploadFactory.create(
                storage_path=second_url, report=second_report_row
            )
            dbsession.add(upload)
            dbsession.flush()
    
            tests = dbsession.query(Test).all()
            for test in tests:
                flake = FlakeFactory.create(test=test)
                dbsession.add(flake)
>               dbsession.flush()

.../tests/unit/test_test_results_processor_task.py:583: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f083c853970; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 0, 'end_date': None, 'fail_count': 0, 'recent_passes_count': 0, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f083c45a0c0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (3, null, null, 0, 0, 0, 2024-12-13 20:09:21.548953+00, null, null, 135, 61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 135, 'testid': '61204a68c421283ce112fef0209dae0471d22562764ddf802c774acd3d2fbacc', 'reduced_error_id': None, 'recent_passes_count': 0, 'count': 0, 'fail_count': 0, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 21, 548953), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
tasks/tests/unit/test_test_results_finisher.py::TestUploadTestFinisherTask::test_upload_finisher_task_call_with_flaky[50-150-10]
Stack Traces | 0.18s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f081d69caa0>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f083c11e000>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f0837731120; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (2, null, null, 10, 150, 50, 2024-12-13 20:09:50.542373+00, null, 2, 103, 9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_finisher.TestUploadTestFinisherTask object at 0x7f083e117980>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f08342c3200>
mock_configuration = <shared.config.ConfigHelper object at 0x7f083c11f8f0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f083c11ede0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f083c11e570>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f083c77e4b0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673350947328'>
celery_app = <Celery celery.tests at 0x7f083c77c470>
test_results_mock_app = <MagicMock name='app' id='139673211520112'>
mock_repo_provider_comments = <MagicMock id='139673350096608'>
test_results_setup = (103, Commit<cd76b0821854a780b60012aed85af0a8263004ad@repo<103>>, Pull<47@repo<103>>, [<database.models.reports.TestIn...odels.reports.TestInstance object at 0x7f081d6a69f0>, <database.models.reports.TestInstance object at 0x7f081d6a7410>])
fail_count = 50, count = 150, recent_passes_count = 10

    @pytest.mark.parametrize(
        "fail_count,count,recent_passes_count", [(2, 15, 13), (50, 150, 10)]
    )
    @pytest.mark.integration
    def test_upload_finisher_task_call_with_flaky(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
        test_results_mock_app,
        mock_repo_provider_comments,
        test_results_setup,
        fail_count,
        count,
        recent_passes_count,
    ):
        mock_feature = mocker.patch("services.test_results.FLAKY_TEST_DETECTION")
        mock_feature.check_value.return_value = True
    
        repoid, commit, pull, test_instances = test_results_setup
    
        for i, instance in enumerate(test_instances):
            if i != 2:
                dbsession.delete(instance)
        dbsession.flush()
    
        r = ReducedError()
        r.message = "failure_message"
    
        dbsession.add(r)
        dbsession.flush()
    
        f = Flake()
        f.repoid = repoid
        f.testid = test_instances[2].test_id
        f.reduced_error = r
        f.count = count
        f.fail_count = fail_count
        f.recent_passes_count = recent_passes_count
        f.start_date = datetime.now()
        f.end_date = None
    
        dbsession.add(f)
>       dbsession.flush()

.../tests/unit/test_test_results_finisher.py:881: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f0837731120; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 150, 'end_date': None, 'fail_count': 50, 'recent_passes_count': 10, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f081d69ce60>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (2, null, null, 10, 150, 50, 2024-12-13 20:09:50.542373+00, null, 2, 103, 9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 103, 'testid': '9ca009825ee97275f14b4ce0e47ca037409bfab1c2940ca7a3be50702e11b3cb', 'reduced_error_id': 2, 'recent_passes_count': 10, 'count': 150, 'fail_count': 50, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 50, 542373), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
tasks/tests/unit/test_test_results_finisher.py::TestUploadTestFinisherTask::test_upload_finisher_task_call_with_flaky[2-15-13]
Stack Traces | 0.181s run time
self = <sqlalchemy.engine.base.Connection object at 0x7f08342a42f0>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f08342a5b20>, [{'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f08342aaae0>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f08377323e0; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (1, null, null, 13, 15, 2, 2024-12-13 20:09:50.161754+00, null, 1, 98, 04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb).

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_test_results_finisher.TestUploadTestFinisherTask object at 0x7f083e117770>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f083c77f590>
mock_configuration = <shared.config.ConfigHelper object at 0x7f08342a8a10>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f08342aa840>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f0837a1d9a0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f08342a4200>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139673346157760'>
celery_app = <Celery celery.tests at 0x7f083c11e270>
test_results_mock_app = <MagicMock name='app' id='139673211777392'>
mock_repo_provider_comments = <MagicMock id='139673344264624'>
test_results_setup = (98, Commit<cd76b0821854a780b60012aed85af0a8263004ad@repo<98>>, Pull<40@repo<98>>, [<database.models.reports.TestInsta...odels.reports.TestInstance object at 0x7f08342d26c0>, <database.models.reports.TestInstance object at 0x7f08342a4890>])
fail_count = 2, count = 15, recent_passes_count = 13

    @pytest.mark.parametrize(
        "fail_count,count,recent_passes_count", [(2, 15, 13), (50, 150, 10)]
    )
    @pytest.mark.integration
    def test_upload_finisher_task_call_with_flaky(
        self,
        mocker,
        mock_configuration,
        dbsession,
        codecov_vcr,
        mock_storage,
        mock_redis,
        celery_app,
        test_results_mock_app,
        mock_repo_provider_comments,
        test_results_setup,
        fail_count,
        count,
        recent_passes_count,
    ):
        mock_feature = mocker.patch("services.test_results.FLAKY_TEST_DETECTION")
        mock_feature.check_value.return_value = True
    
        repoid, commit, pull, test_instances = test_results_setup
    
        for i, instance in enumerate(test_instances):
            if i != 2:
                dbsession.delete(instance)
        dbsession.flush()
    
        r = ReducedError()
        r.message = "failure_message"
    
        dbsession.add(r)
        dbsession.flush()
    
        f = Flake()
        f.repoid = repoid
        f.testid = test_instances[2].test_id
        f.reduced_error = r
        f.count = count
        f.fail_count = fail_count
        f.recent_passes_count = recent_passes_count
        f.start_date = datetime.now()
        f.end_date = None
    
        dbsession.add(f)
>       dbsession.flush()

.../tests/unit/test_test_results_finisher.py:881: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.12.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.12.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.12.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.12.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.12.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f083c1748f0>
cursor = <cursor object at 0x7f08377323e0; closed: -1>
statement = 'INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_...ror_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id'
parameters = {'count': 15, 'end_date': None, 'fail_count': 2, 'recent_passes_count': 13, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f08342a5400>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "created_at" of relation "reports_flake" violates not-null constraint
E       DETAIL:  Failing row contains (1, null, null, 13, 15, 2, 2024-12-13 20:09:50.161754+00, null, 1, 98, 04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb).
E       
E       [SQL: INSERT INTO reports_flake (repoid, testid, reduced_error_id, recent_passes_count, count, fail_count, start_date, end_date) VALUES (%(repoid)s, %(testid)s, %(reduced_error_id)s, %(recent_passes_count)s, %(count)s, %(fail_count)s, %(start_date)s, %(end_date)s) RETURNING reports_flake.id]
E       [parameters: {'repoid': 98, 'testid': '04fe188134eaca2acd867dd8963d74e9827304bef169dba386ef7cb906fc0acb', 'reduced_error_id': 1, 'recent_passes_count': 13, 'count': 15, 'fail_count': 2, 'start_date': datetime.datetime(2024, 12, 13, 20, 9, 50, 161754), 'end_date': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

github-actions bot commented Dec 13, 2024

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.99%. Comparing base (0f8147b) to head (eb66157).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
database/models/reports.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #958      +/-   ##
==========================================
- Coverage   97.99%   97.99%   -0.01%     
==========================================
  Files         443      443              
  Lines       35781    35785       +4     
==========================================
+ Hits        35065    35068       +3     
- Misses        716      717       +1     
Flag Coverage Δ
integration 42.15% <80.00%> (+<0.01%) ⬆️
unit 90.64% <80.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joseph-sentry joseph-sentry force-pushed the joseph/handle-new-flake-model branch from 9d389f9 to eb66157 Compare December 16, 2024 17:59
Copy link

This PR includes changes to shared. Please review them here: codecov/shared@e41a4a1...2674ae9

@joseph-sentry joseph-sentry requested a review from a team December 16, 2024 18:04
@joseph-sentry joseph-sentry added this pull request to the merge queue Dec 16, 2024
Merged via the queue into main with commit 536c4e0 Dec 16, 2024
20 of 27 checks passed
@joseph-sentry joseph-sentry deleted the joseph/handle-new-flake-model branch December 16, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants