Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@JerrySentry
Copy link
Contributor

Purpose/Motivation

What is the feature? Why is this being done?

Links to relevant tickets

What does this PR do?

Include a brief description of the changes in this PR. Bullet points are your friend.

Notes to Reviewer

Anything to note to the team? Any tips on how to review, or where to start?

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@github-actions
Copy link
Contributor

This PR includes changes to shared. Please review them here: codecov/shared@88117b9...f408749

@codecov-staging
Copy link

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
2693 5 2688 6
View the top 3 failed tests by shortest run time
services.tests.test_report.ReportServiceTest test_build_report_from_commit_with_flags
Stack Traces | 0.032s run time
self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_flags>
read_chunks_mock = <MagicMock name='read_chunks' id='140245586191008'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_flags(self, read_chunks_mock):
        f = open(current_file.parent / "samples" / "chunks.txt", "r")
        read_chunks_mock.return_value = f.read()
        commit = CommitWithReportFactory.create(message="aaaaa", commitid="abf6d4d")
        report = build_report_from_commit(commit)
        res = report.flags["integrations"].report
        assert len(res.report._chunks) == 3
        assert len(res.files) == 3
>       file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
E       AttributeError: 'FilteredReport' object has no attribute 'file_reports'

services/tests/test_report.py:216: AttributeError
services.tests.test_report.ReportServiceTest test_build_report_from_commit_with_non_carried_forward_flags
Stack Traces | 0.035s run time
self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_non_carried_forward_flags>
read_chunks_mock = <MagicMock name='read_chunks' id='140245586355616'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_non_carried_forward_flags(
        self, read_chunks_mock
    ):
        f = open(current_file.parent / "samples" / "chunks.txt", "r")
        read_chunks_mock.return_value = f.read()
        commit = CommitWithReportFactory.create(
            message="another test",
            commitid="asdfbhasdf89",
        )
        commit_report = commit.reports.first()
        session = commit_report.sessions.filter(order_number=1).first()
        session.upload_type = "carriedforward"
        session.upload_extras = {
            "carriedforward_from": "56e05fced214c44a37759efa2dfc25a65d8ae98d"
        }
        session.save()
    
        report = build_report_from_commit(commit)
        res = report.flags["integrations"].report
        assert len(res.report._chunks) == 3
        assert len(res.files) == 3
>       file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
E       AttributeError: 'FilteredReport' object has no attribute 'file_reports'

services/tests/test_report.py:248: AttributeError
codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest test_update_user_when_agreement_is_false
Stack Traces | 0.366s run time
self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
        self.db.validate_no_broken_transaction()
        with self.db.wrap_database_errors:
            if params is None:
                # params default might be backend specific.
                return self.cursor.execute(sql)
            else:
>               return self.cursor.execute(sql, params)
E               psycopg2.errors.NotNullViolation: null value in column "email_opt_in" of relation "users" violates not-null constraint
E               DETAIL:  Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

.../local/lib/python3.12.../db/backends/utils.py:89: NotNullViolation

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

self = <codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest testMethod=test_update_user_when_agreement_is_false>

    @freeze_time("2022-01-01T00:00:00")
    def test_update_user_when_agreement_is_false(self):
>       self.execute(
            current_user=self.current_user,
            input={"terms_agreement": False, "customer_intent": "Business"},
        )

.../interactors/tests/test_save_terms_agreement.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12............/site-packages/asgiref/sync.py:240: in __call__
    return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
    return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
    raise self._exception
.../local/lib/python3.12............/site-packages/asgiref/sync.py:306: in main_wrap
    result = await self.awaitable(*args, **kwargs)
.../local/lib/python3.12............/site-packages/asgiref/sync.py:448: in __call__
    ret = await asyncio.wait_for(future, timeout=None)
.../local/lib/python3.12/asyncio/tasks.py:520: in wait_for
    return await fut
.../local/lib/python3.12.../site-packages/asgiref/current_thread_executor.py:22: in run
    result = self.fn(*self.args, **self.kwargs)
codecov/db/__init__.py:82: in thread_handler
    return super().thread_handler(loop, *args, **kwargs)
.../local/lib/python3.12............/site-packages/asgiref/sync.py:490: in thread_handler
    return func(*args, **kwargs)
.../owner/interactors/save_terms_agreement.py:62: in execute
    return self.update_terms_agreement(typed_input)
.../owner/interactors/save_terms_agreement.py:38: in update_terms_agreement
    self.current_user.save()
.../local/lib/python3.12.../db/models/base.py:814: in save
    self.save_base(
.../local/lib/python3.12.../db/models/base.py:877: in save_base
    updated = self._save_table(
.../local/lib/python3.12.../db/models/base.py:990: in _save_table
    updated = self._do_update(
.../local/lib/python3.12.../site-packages/django_prometheus/models.py:47: in _do_update
    return super()._do_update(*args, **kwargs)
.../local/lib/python3.12.../db/models/base.py:1054: in _do_update
    return filtered._update(values) > 0
.../local/lib/python3.12.../db/models/query.py:1231: in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
.../local/lib/python3.12.../models/sql/compiler.py:1984: in execute_sql
    cursor = super().execute_sql(result_type)
.../local/lib/python3.12.../models/sql/compiler.py:1562: in execute_sql
    cursor.execute(sql, params)
.../local/lib/python3.12.../site-packages/sentry_sdk/utils.py:1730: in runner
    return sentry_patched_function(*args, **kwargs)
.../local/lib/python3.12.../integrations/django/__init__.py:651: in execute
    result = real_execute(self, sql, params)
.../local/lib/python3.12.../db/backends/utils.py:67: in execute
    return self._execute_with_wrappers(
.../local/lib/python3.12.../db/backends/utils.py:80: in _execute_with_wrappers
    return executor(sql, params, many, context)
.../local/lib/python3.12.../db/backends/utils.py:84: in _execute
    with self.db.wrap_database_errors:
.../local/lib/python3.12.../django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
        self.db.validate_no_broken_transaction()
        with self.db.wrap_database_errors:
            if params is None:
                # params default might be backend specific.
                return self.cursor.execute(sql)
            else:
>               return self.cursor.execute(sql, params)
E               django.db.utils.IntegrityError: null value in column "email_opt_in" of relation "users" violates not-null constraint
E               DETAIL:  Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

.../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@codecov-qa
Copy link

codecov-qa bot commented Oct 17, 2024

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
2693 5 2688 6
View the top 3 failed tests by shortest run time
services.tests.test_report.ReportServiceTest test_build_report_from_commit_with_flags
Stack Traces | 0.032s run time
self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_flags>
read_chunks_mock = <MagicMock name='read_chunks' id='140245586191008'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_flags(self, read_chunks_mock):
        f = open(current_file.parent / "samples" / "chunks.txt", "r")
        read_chunks_mock.return_value = f.read()
        commit = CommitWithReportFactory.create(message="aaaaa", commitid="abf6d4d")
        report = build_report_from_commit(commit)
        res = report.flags["integrations"].report
        assert len(res.report._chunks) == 3
        assert len(res.files) == 3
>       file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
E       AttributeError: 'FilteredReport' object has no attribute 'file_reports'

services/tests/test_report.py:216: AttributeError
services.tests.test_report.ReportServiceTest test_build_report_from_commit_with_non_carried_forward_flags
Stack Traces | 0.035s run time
self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_non_carried_forward_flags>
read_chunks_mock = <MagicMock name='read_chunks' id='140245586355616'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_non_carried_forward_flags(
        self, read_chunks_mock
    ):
        f = open(current_file.parent / "samples" / "chunks.txt", "r")
        read_chunks_mock.return_value = f.read()
        commit = CommitWithReportFactory.create(
            message="another test",
            commitid="asdfbhasdf89",
        )
        commit_report = commit.reports.first()
        session = commit_report.sessions.filter(order_number=1).first()
        session.upload_type = "carriedforward"
        session.upload_extras = {
            "carriedforward_from": "56e05fced214c44a37759efa2dfc25a65d8ae98d"
        }
        session.save()
    
        report = build_report_from_commit(commit)
        res = report.flags["integrations"].report
        assert len(res.report._chunks) == 3
        assert len(res.files) == 3
>       file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
E       AttributeError: 'FilteredReport' object has no attribute 'file_reports'

services/tests/test_report.py:248: AttributeError
codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest test_update_user_when_agreement_is_false
Stack Traces | 0.366s run time
self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
        self.db.validate_no_broken_transaction()
        with self.db.wrap_database_errors:
            if params is None:
                # params default might be backend specific.
                return self.cursor.execute(sql)
            else:
>               return self.cursor.execute(sql, params)
E               psycopg2.errors.NotNullViolation: null value in column "email_opt_in" of relation "users" violates not-null constraint
E               DETAIL:  Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

.../local/lib/python3.12.../db/backends/utils.py:89: NotNullViolation

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

self = <codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest testMethod=test_update_user_when_agreement_is_false>

    @freeze_time("2022-01-01T00:00:00")
    def test_update_user_when_agreement_is_false(self):
>       self.execute(
            current_user=self.current_user,
            input={"terms_agreement": False, "customer_intent": "Business"},
        )

.../interactors/tests/test_save_terms_agreement.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.12............/site-packages/asgiref/sync.py:240: in __call__
    return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
    return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
    raise self._exception
.../local/lib/python3.12............/site-packages/asgiref/sync.py:306: in main_wrap
    result = await self.awaitable(*args, **kwargs)
.../local/lib/python3.12............/site-packages/asgiref/sync.py:448: in __call__
    ret = await asyncio.wait_for(future, timeout=None)
.../local/lib/python3.12/asyncio/tasks.py:520: in wait_for
    return await fut
.../local/lib/python3.12.../site-packages/asgiref/current_thread_executor.py:22: in run
    result = self.fn(*self.args, **self.kwargs)
codecov/db/__init__.py:82: in thread_handler
    return super().thread_handler(loop, *args, **kwargs)
.../local/lib/python3.12............/site-packages/asgiref/sync.py:490: in thread_handler
    return func(*args, **kwargs)
.../owner/interactors/save_terms_agreement.py:62: in execute
    return self.update_terms_agreement(typed_input)
.../owner/interactors/save_terms_agreement.py:38: in update_terms_agreement
    self.current_user.save()
.../local/lib/python3.12.../db/models/base.py:814: in save
    self.save_base(
.../local/lib/python3.12.../db/models/base.py:877: in save_base
    updated = self._save_table(
.../local/lib/python3.12.../db/models/base.py:990: in _save_table
    updated = self._do_update(
.../local/lib/python3.12.../site-packages/django_prometheus/models.py:47: in _do_update
    return super()._do_update(*args, **kwargs)
.../local/lib/python3.12.../db/models/base.py:1054: in _do_update
    return filtered._update(values) > 0
.../local/lib/python3.12.../db/models/query.py:1231: in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
.../local/lib/python3.12.../models/sql/compiler.py:1984: in execute_sql
    cursor = super().execute_sql(result_type)
.../local/lib/python3.12.../models/sql/compiler.py:1562: in execute_sql
    cursor.execute(sql, params)
.../local/lib/python3.12.../site-packages/sentry_sdk/utils.py:1730: in runner
    return sentry_patched_function(*args, **kwargs)
.../local/lib/python3.12.../integrations/django/__init__.py:651: in execute
    result = real_execute(self, sql, params)
.../local/lib/python3.12.../db/backends/utils.py:67: in execute
    return self._execute_with_wrappers(
.../local/lib/python3.12.../db/backends/utils.py:80: in _execute_with_wrappers
    return executor(sql, params, many, context)
.../local/lib/python3.12.../db/backends/utils.py:84: in _execute
    with self.db.wrap_database_errors:
.../local/lib/python3.12.../django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
        self.db.validate_no_broken_transaction()
        with self.db.wrap_database_errors:
            if params is None:
                # params default might be backend specific.
                return self.cursor.execute(sql)
            else:
>               return self.cursor.execute(sql, params)
E               django.db.utils.IntegrityError: null value in column "email_opt_in" of relation "users" violates not-null constraint
E               DETAIL:  Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

.../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@codecov-public-qa
Copy link

Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.

❌ Failed Test Results:

Completed 2699 tests with 5 failed, 2688 passed and 6 skipped.

View the full list of failed tests

pytest

  • Class name: codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest
    Test name: test_update_owner_and_user_when_email_is_not_empty

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c63d760>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 3, 852541, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c63d760>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E psycopg2.errors.NotNullViolation: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3990, f65d742c-405f-4fd5-be24-96e080aa7fa7, 2024-10-17 20:09:03.852541+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, t, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: NotNullViolation

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

    self = <codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest testMethod=test_update_owner_and_user_when_email_is_not_empty>

    @freeze_time("2022-01-01T00:00:00")
    def test_update_owner_and_user_when_email_is_not_empty(self):
    > self.execute(
    current_user=self.current_user,
    input={
    "business_email": "[email protected]",
    "terms_agreement": True,
    "customer_intent": "Business",
    },
    )

    .../interactors/tests/test_save_terms_agreement.py:66:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:240: in __call__
    return call_result.result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
    return self.__get_result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
    raise self._exception
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:306: in main_wrap
    result = await self.awaitable(*args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:448: in __call__
    ret = await asyncio.wait_for(future, timeout=None)
    .../local/lib/python3.12/asyncio/tasks.py:520: in wait_for
    return await fut
    .../local/lib/python3.12.../site-packages/asgiref/current_thread_executor.py:22: in run
    result = self.fn(*self.args, **self.kwargs)
    codecov/db/__init__.py:82: in thread_handler
    return super().thread_handler(loop, *args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:490: in thread_handler
    return func(*args, **kwargs)
    .../owner/interactors/save_terms_agreement.py:62: in execute
    return self.update_terms_agreement(typed_input)
    .../owner/interactors/save_terms_agreement.py:38: in update_terms_agreement
    self.current_user.save()
    .../local/lib/python3.12.../db/models/base.py:814: in save
    self.save_base(
    .../local/lib/python3.12.../db/models/base.py:877: in save_base
    updated = self._save_table(
    .../local/lib/python3.12.../db/models/base.py:990: in _save_table
    updated = self._do_update(
    .../local/lib/python3.12.../site-packages/django_prometheus/models.py:47: in _do_update
    return super()._do_update(*args, **kwargs)
    .../local/lib/python3.12.../db/models/base.py:1054: in _do_update
    return filtered._update(values) > 0
    .../local/lib/python3.12.../db/models/query.py:1231: in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
    .../local/lib/python3.12.../models/sql/compiler.py:1984: in execute_sql
    cursor = super().execute_sql(result_type)
    .../local/lib/python3.12.../models/sql/compiler.py:1562: in execute_sql
    cursor.execute(sql, params)
    .../local/lib/python3.12.../site-packages/sentry_sdk/utils.py:1730: in runner
    return sentry_patched_function(*args, **kwargs)
    .../local/lib/python3.12.../integrations/django/__init__.py:651: in execute
    result = real_execute(self, sql, params)
    .../local/lib/python3.12.../db/backends/utils.py:67: in execute
    return self._execute_with_wrappers(
    .../local/lib/python3.12.../db/backends/utils.py:80: in _execute_with_wrappers
    return executor(sql, params, many, context)
    .../local/lib/python3.12.../db/backends/utils.py:84: in _execute
    with self.db.wrap_database_errors:
    .../local/lib/python3.12.../django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c63d760>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 3, 852541, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c63d760>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E django.db.utils.IntegrityError: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3990, f65d742c-405f-4fd5-be24-96e080aa7fa7, 2024-10-17 20:09:03.852541+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, t, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest
    Test name: test_update_user_when_agreement_is_false

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E psycopg2.errors.NotNullViolation: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: NotNullViolation

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

    self = <codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest testMethod=test_update_user_when_agreement_is_false>

    @freeze_time("2022-01-01T00:00:00")
    def test_update_user_when_agreement_is_false(self):
    > self.execute(
    current_user=self.current_user,
    input={"terms_agreement": False, "customer_intent": "Business"},
    )

    .../interactors/tests/test_save_terms_agreement.py:38:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:240: in __call__
    return call_result.result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
    return self.__get_result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
    raise self._exception
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:306: in main_wrap
    result = await self.awaitable(*args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:448: in __call__
    ret = await asyncio.wait_for(future, timeout=None)
    .../local/lib/python3.12/asyncio/tasks.py:520: in wait_for
    return await fut
    .../local/lib/python3.12.../site-packages/asgiref/current_thread_executor.py:22: in run
    result = self.fn(*self.args, **self.kwargs)
    codecov/db/__init__.py:82: in thread_handler
    return super().thread_handler(loop, *args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:490: in thread_handler
    return func(*args, **kwargs)
    .../owner/interactors/save_terms_agreement.py:62: in execute
    return self.update_terms_agreement(typed_input)
    .../owner/interactors/save_terms_agreement.py:38: in update_terms_agreement
    self.current_user.save()
    .../local/lib/python3.12.../db/models/base.py:814: in save
    self.save_base(
    .../local/lib/python3.12.../db/models/base.py:877: in save_base
    updated = self._save_table(
    .../local/lib/python3.12.../db/models/base.py:990: in _save_table
    updated = self._do_update(
    .../local/lib/python3.12.../site-packages/django_prometheus/models.py:47: in _do_update
    return super()._do_update(*args, **kwargs)
    .../local/lib/python3.12.../db/models/base.py:1054: in _do_update
    return filtered._update(values) > 0
    .../local/lib/python3.12.../db/models/query.py:1231: in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
    .../local/lib/python3.12.../models/sql/compiler.py:1984: in execute_sql
    cursor = super().execute_sql(result_type)
    .../local/lib/python3.12.../models/sql/compiler.py:1562: in execute_sql
    cursor.execute(sql, params)
    .../local/lib/python3.12.../site-packages/sentry_sdk/utils.py:1730: in runner
    return sentry_patched_function(*args, **kwargs)
    .../local/lib/python3.12.../integrations/django/__init__.py:651: in execute
    result = real_execute(self, sql, params)
    .../local/lib/python3.12.../db/backends/utils.py:67: in execute
    return self._execute_with_wrappers(
    .../local/lib/python3.12.../db/backends/utils.py:80: in _execute_with_wrappers
    return executor(sql, params, many, context)
    .../local/lib/python3.12.../db/backends/utils.py:84: in _execute
    with self.db.wrap_database_errors:
    .../local/lib/python3.12.../django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 4, 448776, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d5c6a57f0>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E django.db.utils.IntegrityError: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3991, 7d6d63b6-3c5b-472e-aab4-ab9f18530b18, 2024-10-17 20:09:04.448776+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, f, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest
    Test name: test_update_user_when_agreement_is_true

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d70134d70>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 5, 20799, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d70134d70>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E psycopg2.errors.NotNullViolation: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3992, 57d28aa1-e45c-4e43-bd69-5170cdfdbe4e, 2024-10-17 20:09:05.020799+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, t, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: NotNullViolation

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

    self = <codecov_auth.commands.owner.interactors.tests.test_save_terms_agreement.UpdateSaveTermsAgreementInteractorTest testMethod=test_update_user_when_agreement_is_true>

    @freeze_time("2022-01-01T00:00:00")
    def test_update_user_when_agreement_is_true(self):
    > self.execute(
    current_user=self.current_user,
    input={"terms_agreement": True, "customer_intent": "Business"},
    )

    .../interactors/tests/test_save_terms_agreement.py:52:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:240: in __call__
    return call_result.result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
    return self.__get_result()
    .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
    raise self._exception
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:306: in main_wrap
    result = await self.awaitable(*args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:448: in __call__
    ret = await asyncio.wait_for(future, timeout=None)
    .../local/lib/python3.12/asyncio/tasks.py:520: in wait_for
    return await fut
    .../local/lib/python3.12.../site-packages/asgiref/current_thread_executor.py:22: in run
    result = self.fn(*self.args, **self.kwargs)
    codecov/db/__init__.py:82: in thread_handler
    return super().thread_handler(loop, *args, **kwargs)
    .../local/lib/python3.12............/site-packages/asgiref/sync.py:490: in thread_handler
    return func(*args, **kwargs)
    .../owner/interactors/save_terms_agreement.py:62: in execute
    return self.update_terms_agreement(typed_input)
    .../owner/interactors/save_terms_agreement.py:38: in update_terms_agreement
    self.current_user.save()
    .../local/lib/python3.12.../db/models/base.py:814: in save
    self.save_base(
    .../local/lib/python3.12.../db/models/base.py:877: in save_base
    updated = self._save_table(
    .../local/lib/python3.12.../db/models/base.py:990: in _save_table
    updated = self._do_update(
    .../local/lib/python3.12.../site-packages/django_prometheus/models.py:47: in _do_update
    return super()._do_update(*args, **kwargs)
    .../local/lib/python3.12.../db/models/base.py:1054: in _do_update
    return filtered._update(values) > 0
    .../local/lib/python3.12.../db/models/query.py:1231: in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
    .../local/lib/python3.12.../models/sql/compiler.py:1984: in execute_sql
    cursor = super().execute_sql(result_type)
    .../local/lib/python3.12.../models/sql/compiler.py:1562: in execute_sql
    cursor.execute(sql, params)
    .../local/lib/python3.12.../site-packages/sentry_sdk/utils.py:1730: in runner
    return sentry_patched_function(*args, **kwargs)
    .../local/lib/python3.12.../integrations/django/__init__.py:651: in execute
    result = real_execute(self, sql, params)
    .../local/lib/python3.12.../db/backends/utils.py:67: in execute
    return self._execute_with_wrappers(
    .../local/lib/python3.12.../db/backends/utils.py:80: in _execute_with_wrappers
    return executor(sql, params, many, context)
    .../local/lib/python3.12.../db/backends/utils.py:84: in _execute
    with self.db.wrap_database_errors:
    .../local/lib/python3.12.../django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    self = <django.db.backends.utils.CursorWrapper object at 0x7f8d70134d70>
    sql = 'UPDATE "users" SET "created_at" = %s, "updated_at" = %s, "email" = %s, "name" = %s, "is_staff" = %s, "is_superuser" =...erms_agreement" = %s, "terms_agreement_at" = %s, "customer_intent" = %s, "email_opt_in" = NULL WHERE "users"."id" = %s'
    params = (datetime.datetime(2024, 10, 17, 20, 9, 5, 20799, tzinfo=datetime.timezone.utc), FakeDatetime(2022, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), '[email protected]', 'codecov-user', False, False, ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f8d70134d70>})

    def _execute(self, sql, params, *ignored_wrapper_args):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
    if params is None:
    # params default might be backend specific.
    return self.cursor.execute(sql)
    else:
    > return self.cursor.execute(sql, params)
    E django.db.utils.IntegrityError: null value in column "email_opt_in" of relation "users" violates not-null constraint
    E DETAIL: Failing row contains (3992, 57d28aa1-e45c-4e43-bd69-5170cdfdbe4e, 2024-10-17 20:09:05.020799+00, 2022-01-01 00:00:00+00, [email protected], codecov-user, f, f, t, 2022-01-01 00:00:00, Business, null).

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: services.tests.test_report.ReportServiceTest
    Test name: test_build_report_from_commit_with_flags

    self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_flags>
    read_chunks_mock = <MagicMock name='read_chunks' id='140245586191008'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_flags(self, read_chunks_mock):
    f = open(current_file.parent / "samples" / "chunks.txt", "r")
    read_chunks_mock.return_value = f.read()
    commit = CommitWithReportFactory.create(message="aaaaa", commitid="abf6d4d")
    report = build_report_from_commit(commit)
    res = report.flags["integrations"].report
    assert len(res.report._chunks) == 3
    assert len(res.files) == 3
    > file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
    E AttributeError: 'FilteredReport' object has no attribute 'file_reports'

    services/tests/test_report.py:216: AttributeError
  • Class name: services.tests.test_report.ReportServiceTest
    Test name: test_build_report_from_commit_with_non_carried_forward_flags

    self = <services.tests.test_report.ReportServiceTest testMethod=test_build_report_from_commit_with_non_carried_forward_flags>
    read_chunks_mock = <MagicMock name='read_chunks' id='140245586355616'>

    @patch("services.archive.ArchiveService.read_chunks")
    def test_build_report_from_commit_with_non_carried_forward_flags(
    self, read_chunks_mock
    ):
    f = open(current_file.parent / "samples" / "chunks.txt", "r")
    read_chunks_mock.return_value = f.read()
    commit = CommitWithReportFactory.create(
    message="another test",
    commitid="asdfbhasdf89",
    )
    commit_report = commit.reports.first()
    session = commit_report.sessions.filter(order_number=1).first()
    session.upload_type = "carriedforward"
    session.upload_extras = {
    "carriedforward_from": "56e05fced214c44a37759efa2dfc25a65d8ae98d"
    }
    session.save()

    report = build_report_from_commit(commit)
    res = report.flags["integrations"].report
    assert len(res.report._chunks) == 3
    assert len(res.files) == 3
    > file_1, file_2, file_3 = sorted(res.file_reports(), key=lambda x: x.name)
    E AttributeError: 'FilteredReport' object has no attribute 'file_reports'

    services/tests/test_report.py:248: AttributeError

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants