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

Run django db migrations for tests #729

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

michelletran-codecov
Copy link
Contributor

This ensures that the table that the models run on are the Django models, rather than the slightly less accurate SQLAlchemy models.

Some of the fixes:

  • enforce constraints defined in DB
  • add default values for models for models that were not nullable
  • fixed factory side effects when specifying a default linked value (i.e. don't set foreign keys if we're not ready for that object to actually exist). This involved some hacks to set the value to null, flush to DB, then set the int as foreign key (but don't flush, as that's when that object gets created).
  • removed duplication (especially when creating objects that had unique constraints) by creating fixtures for some repeatedly created objects

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.

This was originally bootstrapping separately with Django and SQLAlchemy
creating separate databases. This ensures that Django bootstraps the test
database with (more canonical) Django models. SQLAlchemy will reuse the
database that Django bootstraps for testing purposes.
There are quite a few tables that are not moved to `shared` yet. So for the sake
of getting tests to work, I'm bootstrapping them with the SQLAlchemy models.
This is getting this more similar to how the models are defined in Django
This is because the tests were failing on duplicate keys. Fixtures reuses existing
objects, which avoids creating objects with duplicate keys.
This was failing on null values. Using the factory will fill in the
fields that are required.
This helps reduce database key conflicts by reusing existing objects for tests
This is because the actual DB value is timezone aware.
Copy link

codecov bot commented Sep 19, 2024

❌ 31 Tests Failed:

Tests completed Failed Passed Skipped
1695 31 1664 0
View the top 3 failed tests by shortest run time
tasks.tests.unit.test_process_flakes test_it_does_not_detect_unmerged_tests
Stack Traces | 0.007s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_creates_flakes_fail_after_merge
Stack Traces | 0.008s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_creates_flakes_from_orig_branch
Stack Traces | 0.008s run time
No failure message available

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

@codecov-notifications
Copy link

codecov-notifications bot commented Sep 19, 2024

❌ 31 Tests Failed:

Tests completed Failed Passed Skipped
1695 31 1664 0
View the top 3 failed tests by shortest run time
tasks.tests.unit.test_process_flakes test_it_does_not_detect_unmerged_tests
Stack Traces | 0.007s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_creates_flakes_expires
Stack Traces | 0.008s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_processes_two_commits_together
Stack Traces | 0.009s run time
No failure message available

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 Sep 19, 2024

❌ 31 Tests Failed:

Tests completed Failed Passed Skipped
1695 31 1664 0
View the top 3 failed tests by shortest run time
tasks.tests.unit.test_process_flakes test_it_creates_flakes_expires
Stack Traces | 0.008s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_creates_flakes_from_new_branch_only
Stack Traces | 0.008s run time
No failure message available
tasks.tests.unit.test_process_flakes test_it_handles_only_passes
Stack Traces | 0.008s run time
No failure message available

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

Copy link

codecov-public-qa bot commented Sep 19, 2024

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

❌ Failed Test Results:

Completed 1695 tests with 31 failed, 1664 passed and 0 skipped.

View the full list of failed tests

pytest

  • Class name: services.bundle_analysis.notify.tests.test_helpers
    Test name: test_get_configuration_types_configured[default_values_github_with_apps]

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3c3bc3b0>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 7, 6, 692451, tzinfo=datetime.timezone.utc), 'external_id': UUID('73a5447c-9adb-48be-9537-2fc19a6c8083'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b3faaf950>, [{'name': 'codecov_app_installation', 'owner_id': 2967}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3fe335f0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3faae840>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab54e0; closed: -1>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 7, 6, 692451, tzinfo=datetime.timezone.utc), 'external_id': UUID('73a5447c-9adb-48be-9537-2fc19a6c8083'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3faae840>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.NotNullViolation: null value in column "installation_id" of relation "codecov_auth_githubappinstallation" violates not-null constraint
    E DETAIL: Failing row contains (23, 73a5447c-9adb-48be-9537-2fc19a6c8083, 2024-09-19 21:07:06.692451+00, 2024-09-19 21:07:06.692459+00, null, codecov_app_installation, null, 2967, null, null, f).

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

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

    config = {'comment': {'require_bundle_changes': False}}
    owner_fixture = 'github_owner_with_apps'
    expected = (<NotificationType.PR_COMMENT: 'pr_comment'>, <NotificationType.GITHUB_COMMIT_CHECK: 'github_commit_check'>)
    request = <FixtureRequest for <Function test_get_configuration_types_configured[default_values_github_with_apps]>>

    @pytest.mark.parametrize(
    "config, owner_fixture, expected",
    [
    pytest.param(
    {"comment": False, "bundle_analysis": {"status": False}},
    "github_owner_no_apps",
    (),
    id="no_notification_configured",
    ),
    # The default site configuration puts the `comment` as a dict
    pytest.param(
    {"comment": {"require_bundle_changes": False}},
    "github_owner_no_apps",
    (NotificationType.PR_COMMENT, NotificationType.COMMIT_STATUS),
    id="default_values_github_no_apps",
    ),
    pytest.param(
    {"comment": {"require_bundle_changes": False}},
    "github_owner_with_apps",
    (NotificationType.PR_COMMENT, NotificationType.GITHUB_COMMIT_CHECK),
    id="default_values_github_with_apps",
    ),
    pytest.param(
    {"comment": {"require_bundle_changes": False}},
    "gitlab_owner",
    (NotificationType.PR_COMMENT, NotificationType.COMMIT_STATUS),
    id="default_values_gitlab",
    ),
    pytest.param(
    {"comment": False, "bundle_analysis": {"status": True}},
    "gitlab_owner",
    (NotificationType.COMMIT_STATUS,),
    id="just_commit_status",
    ),
    pytest.param(
    {
    "comment": {"require_bundle_changes": False},
    "bundle_analysis": {"status": False},
    },
    "gitlab_owner",
    (NotificationType.PR_COMMENT,),
    id="just_pr_comment",
    ),
    ],
    )
    def test_get_configuration_types_configured(config, owner_fixture, expected, request):
    > owner = request.getfixturevalue(owner_fixture)

    .../notify/tests/test_helpers.py:117:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:541: in getfixturevalue
    fixturedef = self._get_active_fixturedef(argname)
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:570: in _get_active_fixturedef
    self._compute_fixture_value(fixturedef)
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:647: in _compute_fixture_value
    fixturedef.execute(request=subrequest)
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:1079: in execute
    result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
    .../local/lib/python3.12.../site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    .../local/lib/python3.12.../site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    .../local/lib/python3.12.../site-packages/_pytest/setuponly.py:36: in pytest_fixture_setup
    return (yield)
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:1132: in pytest_fixture_setup
    result = call_fixture_func(fixturefunc, request, kwargs)
    .../local/lib/python3.12................../site-packages/_pytest/fixtures.py:913: in call_fixture_func
    fixture_result = fixturefunc(**kwargs)
    .../notify/tests/test_helpers.py:58: in github_owner_with_apps
    dbsession.commit()
    .../local/lib/python3.12.../sqlalchemy/orm/session.py:1046: in commit
    self.transaction.commit()
    .../local/lib/python3.12.../sqlalchemy/orm/session.py:504: in commit
    self._prepare_impl()
    .../local/lib/python3.12.../sqlalchemy/orm/session.py:483: in _prepare_impl
    self.session.flush()
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab54e0; closed: -1>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 7, 6, 692451, tzinfo=datetime.timezone.utc), 'external_id': UUID('73a5447c-9adb-48be-9537-2fc19a6c8083'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3faae840>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "installation_id" of relation "codecov_auth_githubappinstallation" violates not-null constraint
    E DETAIL: Failing row contains (23, 73a5447c-9adb-48be-9537-2fc19a6c8083, 2024-09-19 21:07:06.692451+00, 2024-09-19 21:07:06.692459+00, null, codecov_app_installation, null, 2967, null, null, f).
    E
    E [SQL: INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id]
    E [parameters: {'external_id': UUID('73a5447c-9adb-48be-9537-2fc19a6c8083'), 'created_at': datetime.datetime(2024, 9, 19, 21, 7, 6, 692451, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2024, 9, 19, 21, 7, 6, 692459, tzinfo=datetime.timezone.utc), 'name': 'codecov_app_installation', 'owner_id': 2967, 'is_suspended': False}]
    E (Background on this error at: http://sqlalche..../e/13/gkpj)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
  • Class name: services.notification.notifiers.tests.unit.test_comment.TestCommentNotifierWelcome
    Test name: test_build_message

    self = <test_comment.TestCommentNotifierWelcome object at 0x7f9b691bf3e0>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b5fb52300>
    mock_configuration = <shared.config.ConfigHelper object at 0x7f9b5fdb0b60>
    mock_repo_provider = <MagicMock name='_get_repo_provider_service_instance()' spec='Github' id='140305377681840'>
    sample_comparison = <services.comparison.ComparisonProxy object at 0x7f9b5fc428d0>

    @pytest.mark.asyncio
    async def test_build_message(
    self, dbsession, mock_configuration, mock_repo_provider, sample_comparison
    ):
    mock_configuration.params["setup"]["codecov_dashboard_url"] = "test.example.br"

    notifier = CommentNotifier(
    repository=sample_comparison.head.commit.repository,
    title="title",
    notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
    notifier_site_settings=True,
    current_yaml={},
    )
    result = await notifier.build_message(sample_comparison)
    expected_result = [
    "## Welcome to [Codecov](https://codecov.io) :tada:",
    "",
    "Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.",
    "",
    "Thanks for integrating Codecov - We've got you covered :open_umbrella:",
    ]
    for exp, res in zip(expected_result, result):
    > assert exp == res
    E AssertionError: assert 'Thanks for i...pen_umbrella:' == ':information...uest-comment)'
    E
    E - :information_source: You can also turn on [project coverage checks](https://docs.codecov.com/docs/common-recipe-list#set-project-coverage-checks-on-a-pull-request) and [project coverage reporting on Pull Request comment](https://docs.codecov.com/docs/common-recipe-list#show-project-coverage-changes-on-the-pull-request-comment)
    E + Thanks for integrating Codecov - We've got you covered :open_umbrella:

    .../tests/unit/test_comment.py:5149: AssertionError
  • Class name: services.notification.notifiers.tests.unit.test_comment.TestCommentNotifierWelcome
    Test name: test_build_message_with_preexisting_bundle_pulls

    self = <test_comment.TestCommentNotifierWelcome object at 0x7f9b691c0350>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b5fafaed0>
    mock_configuration = <shared.config.ConfigHelper object at 0x7f9b5fb24b90>
    mock_repo_provider = <MagicMock name='_get_repo_provider_service_instance()' spec='Github' id='140305374462032'>

    @pytest.mark.asyncio
    async def test_build_message_with_preexisting_bundle_pulls(
    self, dbsession, mock_configuration, mock_repo_provider
    ):
    mock_configuration.params["setup"]["codecov_dashboard_url"] = "test.example.br"

    owner = OwnerFactory.create(
    service="github",
    )
    repository = RepositoryFactory.create(owner=owner)
    branch = "new_branch"
    # artificially create multiple pull entries with BA comments only
    ba_pull_one = PullFactory.create(
    repository=repository,
    base=CommitFactory.create(repository=repository).commitid,
    head=CommitFactory.create(repository=repository, branch=branch).commitid,
    commentid=None,
    bundle_analysis_commentid="98123978",
    )
    ba_pull_two = PullFactory.create(
    repository=repository,
    base=CommitFactory.create(repository=repository).commitid,
    head=CommitFactory.create(repository=repository, branch=branch).commitid,
    commentid=None,
    bundle_analysis_commentid="23982347",
    )
    # Add these entries first so they are created before the pull with commentid only
    dbsession.add_all([ba_pull_one, ba_pull_two])
    dbsession.flush()

    # Create new coverage pull
    base_commit = CommitFactory.create(repository=repository)
    head_commit = CommitFactory.create(repository=repository, branch=branch)
    pull = PullFactory.create(
    repository=repository,
    base=base_commit.commitid,
    head=head_commit.commitid,
    )

    head_report = Report()
    head_file = ReportFile("file_1.go")
    head_file.append(
    1, ReportLine.create(coverage=1, sessions=[[0, 1]], complexity=(10, 2))
    )
    head_report.append(head_file)

    base_report = Report()
    base_file = ReportFile("file_1.go")
    base_file.append(
    1, ReportLine.create(coverage=0, sessions=[[0, 1]], complexity=(10, 2))
    )
    base_report.append(base_file)

    head_full_commit = FullCommit(
    commit=head_commit, report=ReadOnlyReport.create_from_report(head_report)
    )
    base_full_commit = FullCommit(
    commit=base_commit, report=ReadOnlyReport.create_from_report(base_report)
    )
    comparison = ComparisonProxy(
    Comparison(
    head=head_full_commit,
    project_coverage_base=base_full_commit,
    patch_coverage_base_commitid=base_commit.commitid,
    enriched_pull=EnrichedPull(
    database_pull=pull,
    provider_pull={
    "author": {"id": "12345", "username": "codecov-test-user"},
    "base": {"branch": "master", "commitid": base_commit.commitid},
    "head": {
    "branch": "reason/some-testing",
    "commitid": head_commit.commitid,
    },
    "number": str(pull.pullid),
    "id": str(pull.pullid),
    "state": "open",
    "title": "Creating new code for reasons no one knows",
    },
    ),
    )
    )
    dbsession.add_all([repository, base_commit, head_commit, pull])
    dbsession.flush()

    notifier = CommentNotifier(
    repository=comparison.head.commit.repository,
    title="title",
    notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
    notifier_site_settings=True,
    current_yaml={},
    )
    result = await notifier.build_message(comparison)

    expected_result = [
    "## Welcome to [Codecov](https://codecov.io) :tada:",
    "",
    "Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.",
    "",
    "Thanks for integrating Codecov - We've got you covered :open_umbrella:",
    ]
    for exp, res in zip(expected_result, result):
    > assert exp == res
    E AssertionError: assert 'Thanks for i...pen_umbrella:' == ':information...uest-comment)'
    E
    E - :information_source: You can also turn on [project coverage checks](https://docs.codecov.com/docs/common-recipe-list#set-project-coverage-checks-on-a-pull-request) and [project coverage reporting on Pull Request comment](https://docs.codecov.com/docs/common-recipe-list#show-project-coverage-changes-on-the-pull-request-comment)
    E + Thanks for integrating Codecov - We've got you covered :open_umbrella:

    .../tests/unit/test_comment.py:5253: AssertionError
  • Class name: services.notification.tests.unit.test_commit_notifications.TestCommitNotificationsServiceTestCase
    Test name: test_create_or_update_commit_notification_not_yet_exists_no_pull_but_ghapp_info

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b541069c0>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 34, 219879, tzinfo=datetime.timezone.utc), 'external_id': UUID('fc59614a-8473-4f1b-9e46-613fa19cc766'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b54105cd0>, [{'owner_id': 1392}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b49b2e0f0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b49b2f6e0>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b647888b0; closed: -1>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 34, 219879, tzinfo=datetime.timezone.utc), 'external_id': UUID('fc59614a-8473-4f1b-9e46-613fa19cc766'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b49b2f6e0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.NotNullViolation: null value in column "installation_id" of relation "codecov_auth_githubappinstallation" violates not-null constraint
    E DETAIL: Failing row contains (3, fc59614a-8473-4f1b-9e46-613fa19cc766, 2024-09-19 21:05:34.219879+00, 2024-09-19 21:05:34.219884+00, null, codecov_app_installation, null, 1392, null, null, f).

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

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

    self = <test_commit_notifications.TestCommitNotificationsServiceTestCase object at 0x7f9b68ec0b00>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b49b2d970>
    comparison = Comparison(head=FullCommit(commit=Commit<4c50bc88beb7e61017caca072a86e460bbb92d86@repo<392>>, report=None), project_co...=None), patch_coverage_base_commitid='37df8202dbe0d84a3243f230287862cd37676a42', enriched_pull=None, current_yaml=None)

    def test_create_or_update_commit_notification_not_yet_exists_no_pull_but_ghapp_info(
    self, dbsession, comparison
    ):
    comparison.enriched_pull = None
    commit = comparison.head.commit
    app = GithubAppInstallation(owner=commit.repository.owner)
    dbsession.add(app)
    > dbsession.flush()

    .../tests/unit/test_commit_notifications.py:90:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b647888b0; closed: -1>
    statement = 'INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VA...reated_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 34, 219879, tzinfo=datetime.timezone.utc), 'external_id': UUID('fc59614a-8473-4f1b-9e46-613fa19cc766'), 'is_suspended': False, 'name': 'codecov_app_installation', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b49b2f6e0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "installation_id" of relation "codecov_auth_githubappinstallation" violates not-null constraint
    E DETAIL: Failing row contains (3, fc59614a-8473-4f1b-9e46-613fa19cc766, 2024-09-19 21:05:34.219879+00, 2024-09-19 21:05:34.219884+00, null, codecov_app_installation, null, 1392, null, null, f).
    E
    E [SQL: INSERT INTO codecov_auth_githubappinstallation (external_id, created_at, updated_at, name, owner_id, is_suspended) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(name)s, %(owner_id)s, %(is_suspended)s) RETURNING codecov_auth_githubappinstallation.id]
    E [parameters: {'external_id': UUID('fc59614a-8473-4f1b-9e46-613fa19cc766'), 'created_at': datetime.datetime(2024, 9, 19, 21, 5, 34, 219879, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2024, 9, 19, 21, 5, 34, 219884, tzinfo=datetime.timezone.utc), 'name': 'codecov_app_installation', 'owner_id': 1392, 'is_suspended': False}]
    E (Background on this error at: http://sqlalche..../e/13/gkpj)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
  • Class name: services.tests.test_billing.TestBillingServiceTestCase
    Test name: test_plan_not_pr_author

    self = <worker.services.tests.test_billing.TestBillingServiceTestCase object at 0x7f9b6831f830>
    request = <FixtureRequest for <Function test_plan_not_pr_author>>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3ea98410>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b3ecc0590>
    mock_configuration = <shared.config.ConfigHelper object at 0x7f9b3eaa3ef0>
    with_sql_functions = None

    def test_plan_not_pr_author(
    self, request, dbsession, mocker, mock_configuration, with_sql_functions
    ):
    owner = OwnerFactory.create(service="github")
    dbsession.add(owner)
    dbsession.flush()

    > assert not is_pr_billing_plan(owner.plan)
    E AssertionError: assert not True
    E + where True = is_pr_billing_plan('users-basic')
    E + where 'users-basic' = Owner<1526@service<github>>.plan

    services/tests/test_billing.py:41: AssertionError
  • Class name: services.tests.test_report.TestReportService
    Test name: test_build_report_from_commit_fallback

    self = <worker.services.tests.test_report.TestReportService object at 0x7f9b68075c70>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b5fe8e7b0>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b5fdf4b60>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b489b03b0>

    def test_build_report_from_commit_fallback(self, dbsession, mocker, mock_storage):
    commit = CommitFactory()
    dbsession.add(commit)
    dbsession.commit()
    with open(".../tests/samples/sample_chunks_1.txt") as f:
    content = f.read().encode()
    archive_hash = ArchiveService.get_archive_hash(commit.repository)
    chunks_url = f"v4/repos/{archive_hash}/commits/{commit.commitid}/chunks.txt"
    mock_storage.write_file("archive", chunks_url, content)
    res = ReportService({}).build_report_from_commit(commit)
    assert res is not None
    > assert res.files == [
    "awesome/__init__.py",
    "tests/__init__.py",
    "tests/test_sample.py",
    ]
    E AssertionError: assert ['tests/__ini...st_sample.py'] == ['awesome/__i...st_sample.py']
    E
    E At index 0 diff: 'tests/__init__.py' != 'awesome/__init__.py'
    E Use -v to get more diff

    services/tests/test_report.py:771: AssertionError
  • Class name: services.tests.test_report.TestReportService
    Test name: test_create_new_report_for_commit_and_shift

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b5fdf7200>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO reports_reportdetails (external_id, created_at, updated_at, report_id, files_array, files_array_storage_p...t)s, %(report_id)s, CAST(%(files_array)s AS JSONB[]), %(files_array_storage_path)s) RETURNING reports_reportdetails.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 45, 721971, tzinfo=datetime.timezone.utc), 'external_id': UUID('8007c89e-ea5e-42da-8910-f4a20ff64b58'), 'files_array': None, 'files_array_storage_path': None, ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b3e66d970>, [{'files_array': None, 'files_array_storage_path': None, 'report_id': None}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3e64d6d0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b643bcbf0>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b649c3e20; closed: -1>
    statement = 'INSERT INTO reports_reportdetails (external_id, created_at, updated_at, report_id, files_array, files_array_storage_p...t)s, %(report_id)s, CAST(%(files_array)s AS JSONB[]), %(files_array_storage_path)s) RETURNING reports_reportdetails.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 45, 721971, tzinfo=datetime.timezone.utc), 'external_id': UUID('8007c89e-ea5e-42da-8910-f4a20ff64b58'), 'files_array': None, 'files_array_storage_path': None, ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b643bcbf0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.NotNullViolation: null value in column "report_id" of relation "reports_reportdetails" violates not-null constraint
    E DETAIL: Failing row contains (51, 8007c89e-ea5e-42da-8910-f4a20ff64b58, 2024-09-19 21:05:45.721971+00, 2024-09-19 21:05:45.721974+00, null, null, null).

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

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

    self = <worker.services.tests.test_report.TestReportService object at 0x7f9b680128d0>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b48096390>
    sample_report = <Report files=2>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b480972c0>
    mock_repo_provider = <MagicMock name='_get_repo_provider_service_instance()' spec='Github' id='140304743449712'>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b5ff4bf20>

    @pytest.mark.django_db(databases={"default", "timeseries"})
    def test_create_new_report_for_commit_and_shift(
    self, dbsession, sample_report, mocker, mock_repo_provider, mock_storage
    ):
    parent_commit = CommitFactory()
    parent_commit_report = CommitReport(commit_id=parent_commit.id_)
    parent_report_details = ReportDetails(report_id=parent_commit_report.id_)
    dbsession.add(parent_commit)
    dbsession.add(parent_commit_report)
    dbsession.add(parent_report_details)
    > dbsession.flush()

    services/tests/test_report.py:4569:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b649c3e20; closed: -1>
    statement = 'INSERT INTO reports_reportdetails (external_id, created_at, updated_at, report_id, files_array, files_array_storage_p...t)s, %(report_id)s, CAST(%(files_array)s AS JSONB[]), %(files_array_storage_path)s) RETURNING reports_reportdetails.id'
    parameters = {'created_at': datetime.datetime(2024, 9, 19, 21, 5, 45, 721971, tzinfo=datetime.timezone.utc), 'external_id': UUID('8007c89e-ea5e-42da-8910-f4a20ff64b58'), 'files_array': None, 'files_array_storage_path': None, ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b643bcbf0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "report_id" of relation "reports_reportdetails" violates not-null constraint
    E DETAIL: Failing row contains (51, 8007c89e-ea5e-42da-8910-f4a20ff64b58, 2024-09-19 21:05:45.721971+00, 2024-09-19 21:05:45.721974+00, null, null, null).
    E
    E [SQL: INSERT INTO reports_reportdetails (external_id, created_at, updated_at, report_id, files_array, files_array_storage_path) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(report_id)s, CAST(%(files_array)s AS JSONB[]), %(files_array_storage_path)s) RETURNING reports_reportdetails.id]
    E [parameters: {'external_id': UUID('8007c89e-ea5e-42da-8910-f4a20ff64b58'), 'created_at': datetime.datetime(2024, 9, 19, 21, 5, 45, 721971, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2024, 9, 19, 21, 5, 45, 721974, tzinfo=datetime.timezone.utc), 'report_id': None, 'files_array': None, 'files_array_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/gkpj)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: IntegrityError
  • Class name: tasks.tests.unit.test_backfill_commit_data_to_storage_task.TestBackfillCommitDataToStorageTask
    Test name: test_all_report_rows

    self = <worker.tasks.tests.unit.test_backfill_commit_data_to_storage_task.TestBackfillCommitDataToStorageTask object at 0x7f9b66530350>
    mock_handle_single_row = <MagicMock name='handle_single_report_row' id='140305306394192'>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b648d5760>

    @patch(
    "tasks.backfill_commit_data_to_storage.BackfillCommitDataToStorageTask.handle_single_report_row"
    )
    def test_all_report_rows(self, mock_handle_single_row, dbsession):
    def mock_handle_single_row_return_side_effect(db_session, commit, report_row):
    if report_row.code is None:
    return {"success": True, "errors": []}
    if report_row.code == "local":
    return {"success": False, "errors": [BackfillError.missing_data.value]}

    mock_handle_single_row.side_effect = mock_handle_single_row_return_side_effect
    commit = CommitFactory()
    dbsession.add(commit)
    report_default = CommitReport(commit=commit, code=None)
    report_code = CommitReport(commit=commit, code="local")
    dbsession.add(report_default)
    dbsession.add(report_code)
    task = BackfillCommitDataToStorageTask()
    result = task.handle_all_report_rows(dbsession, commit)
    assert result == {"success": False, "errors": ["missing_data"]}
    > mock_handle_single_row.assert_has_calls(
    [
    call(dbsession, commit, report_default),
    call(dbsession, commit, report_code),
    ]
    )
    E AssertionError: Calls not found.
    E Expected: [call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d5850>),
    E call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d6000>)]
    E Actual: [call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d6000>),
    E call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d5850>)]
    E
    E pytest introspection follows:
    E
    E Args:
    E assert (<sqlalchemy....7f9b648d5850>) == ([call(<sqlal...b648d6000>)],)
    E
    E At index 0 diff: <sqlalchemy.orm.session.Session object at 0x7f9b648d5760> != [call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d5850>), call(<sqlalchemy.orm.session.Session object at 0x7f9b648d5760>, Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>, <database.models.reports.CommitReport object at 0x7f9b648d6000>)]
    E Left contains 2 more items, first extra item: Commit<96c84305bbed89e31e4f96db9109cf32827a6d92@repo<680>>
    E Use -v to get more diff

    .../tests/unit/test_backfill_commit_data_to_storage_task.py:84: AssertionError
  • Class name: tasks.tests.unit.test_bundle_analysis_processor_task
    Test name: test_bundle_analysis_process_associate_called

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3cc9d670>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2108, 'branch': None, 'ci_passed': True, 'commitid': '279c45907df0e3e07f87f6cd602089d1192221d0', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b6465ef90>, [{'author': 2108, 'branch': None, 'ci_passed': True, 'commitid': '279c45907df0e3e07f87f6cd602089d1192221d0', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3c63f530>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b5fe0e5a0>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f6a70; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2108, 'branch': None, 'ci_passed': True, 'commitid': '279c45907df0e3e07f87f6cd602089d1192221d0', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b5fe0e5a0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum commit_state: "completed"
    E LINE 1: ...45907df0e3e07f87f6cd602089d1192221d0', NULL, 716, 'completed...
    E ^

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

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

    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b3c63e390>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3c63f9e0>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b3e98acf0>

    def test_bundle_analysis_process_associate_called(
    mocker,
    dbsession,
    mock_storage,
    ):
    storage_path = (
    ".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
    )
    mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

    mocker.patch.object(
    BundleAnalysisProcessorTask,
    "app",
    tasks={
    bundle_analysis_save_measurements_task_name: mocker.MagicMock(),
    },
    )

    parent_commit = CommitFactory.create(state="completed")
    dbsession.add(parent_commit)
    > dbsession.flush()

    .../tests/unit/test_bundle_analysis_processor_task.py:620:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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:1083: in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f6a70; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2108, 'branch': None, 'ci_passed': True, 'commitid': '279c45907df0e3e07f87f6cd602089d1192221d0', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b5fe0e5a0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum commit_state: "completed"
    E LINE 1: ...45907df0e3e07f87f6cd602089d1192221d0', NULL, 716, 'completed...
    E ^
    E
    E [SQL: INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, repoid, state, timestamp, updatestamp, totals, report, report_storage_path) VALUES (%(id)s, %(author)s, %(branch)s, %(ci_passed)s, %(commitid)s, %(deleted)s, %(message)s, %(notified)s, %(merged)s, %(parent)s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)]
    E [parameters: {'id': 1067, 'author': 2108, 'branch': None, 'ci_passed': True, 'commitid': '279c45907df0e3e07f87f6cd602089d1192221d0', 'deleted': None, 'message': 'Positive item mission sister huge.', 'notified': None, 'merged': None, 'parent': '279c45907df0e3e07f87f6cd602089d1192221d0', 'pullid': None, 'repoid': 716, 'state': 'completed', 'timestamp': datetime.datetime(2019, 2, 1, 17, 59, 47), 'updatestamp': None, 'totals': '{"C": 0, "M": 0, "N": 0, "b": 0, "c": "85.00000", "d": 0, "diff": [1, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0], "f": 3, "h": 17, "m": 3, "n": 20, "p": 0, "s": 1}', 'report': '{"files": {"awesome/__init__.py": [2, [0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0], [[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]], [0, 2, ... (483 characters truncated) ... ull, "d": 1547084427, "e": null, "f": ["unit"], "j": null, "n": null, "p": null, "t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0], "": null}}}', 'report_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_bundle_analysis_processor_task
    Test name: test_bundle_analysis_process_associate_called_two

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b5fe0eff0>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2110, 'branch': None, 'ci_passed': True, 'commitid': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b6465ef90>, [{'author': 2110, 'branch': None, 'ci_passed': True, 'commitid': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b5ff882c0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b647ede20>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f6d40; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2110, 'branch': None, 'ci_passed': True, 'commitid': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b647ede20>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum commit_state: "completed"
    E LINE 1: ...adbdc4c1e433af782eddd9aae7a4b4908c85', NULL, 717, 'completed...
    E ^

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

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

    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b6436e360>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b5ff8a330>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b5ff8be60>

    @pytest.mark.django_db(databases={"default", "timeseries"})
    def test_bundle_analysis_process_associate_called_two(
    mocker,
    dbsession,
    mock_storage,
    ):
    storage_path = (
    ".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
    )
    mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

    mocker.patch.object(
    BundleAnalysisProcessorTask,
    "app",
    tasks={
    bundle_analysis_save_measurements_task_name: mocker.MagicMock(),
    },
    )

    parent_commit = CommitFactory.create(state="completed")
    dbsession.add(parent_commit)
    > dbsession.flush()

    .../tests/unit/test_bundle_analysis_processor_task.py:684:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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:1083: in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f6d40; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2110, 'branch': None, 'ci_passed': True, 'commitid': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b647ede20>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum commit_state: "completed"
    E LINE 1: ...adbdc4c1e433af782eddd9aae7a4b4908c85', NULL, 717, 'completed...
    E ^
    E
    E [SQL: INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, repoid, state, timestamp, updatestamp, totals, report, report_storage_path) VALUES (%(id)s, %(author)s, %(branch)s, %(ci_passed)s, %(commitid)s, %(deleted)s, %(message)s, %(notified)s, %(merged)s, %(parent)s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)]
    E [parameters: {'id': 1068, 'author': 2110, 'branch': None, 'ci_passed': True, 'commitid': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', 'deleted': None, 'message': 'White memory those have.', 'notified': None, 'merged': None, 'parent': 'bf38adbdc4c1e433af782eddd9aae7a4b4908c85', 'pullid': None, 'repoid': 717, 'state': 'completed', 'timestamp': datetime.datetime(2019, 2, 1, 17, 59, 47), 'updatestamp': None, 'totals': '{"C": 0, "M": 0, "N": 0, "b": 0, "c": "85.00000", "d": 0, "diff": [1, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0], "f": 3, "h": 17, "m": 3, "n": 20, "p": 0, "s": 1}', 'report': '{"files": {"awesome/__init__.py": [2, [0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0], [[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]], [0, 2, ... (483 characters truncated) ... ull, "d": 1547084427, "e": null, "f": ["unit"], "j": null, "n": null, "p": null, "t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0], "": null}}}', 'report_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_bundle_analysis_processor_task
    Test name: test_bundle_analysis_process_associate_no_parent_commit_id

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3ccee540>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2102, 'branch': None, 'ci_passed': True, 'commitid': 'c1ca272da7a30f7c3545794adebc274b840d16d5', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b6465ef90>, [{'author': 2102, 'branch': None, 'ci_passed': True, 'commitid': 'c1ca272da7a30f7c3545794adebc274b840d16d5', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3ccfdc70>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3c632870>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab7010; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2102, 'branch': None, 'ci_passed': True, 'commitid': 'c1ca272da7a30f7c3545794adebc274b840d16d5', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3c632870>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum commit_state: "completed"
    E LINE 1: ...272da7a30f7c3545794adebc274b840d16d5', NULL, 713, 'completed...
    E ^

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

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

    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b3cca3cb0>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3cca3920>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b3cca3380>

    def test_bundle_analysis_process_associate_no_parent_commit_id(
    mocker,
    dbsession,
    mock_storage,
    ):
    storage_path = (
    ".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
    )
    mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

    mocker.patch.object(
    BundleAnalysisProcessorTask,
    "app",
    tasks={
    bundle_analysis_save_measurements_task_name: mocker.MagicMock(),
    },
    )

    parent_commit = CommitFactory.create(state="completed")
    dbsession.add(parent_commit)
    > dbsession.flush()

    .../tests/unit/test_bundle_analysis_processor_task.py:457:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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:1083: in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab7010; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2102, 'branch': None, 'ci_passed': True, 'commitid': 'c1ca272da7a30f7c3545794adebc274b840d16d5', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3c632870>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum commit_state: "completed"
    E LINE 1: ...272da7a30f7c3545794adebc274b840d16d5', NULL, 713, 'completed...
    E ^
    E
    E [SQL: INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, repoid, state, timestamp, updatestamp, totals, report, report_storage_path) VALUES (%(id)s, %(author)s, %(branch)s, %(ci_passed)s, %(commitid)s, %(deleted)s, %(message)s, %(notified)s, %(merged)s, %(parent)s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)]
    E [parameters: {'id': 1063, 'author': 2102, 'branch': None, 'ci_passed': True, 'commitid': 'c1ca272da7a30f7c3545794adebc274b840d16d5', 'deleted': None, 'message': 'Serious this campaign any evidence current past program.', 'notified': None, 'merged': None, 'parent': 'c1ca272da7a30f7c3545794adebc274b840d16d5', 'pullid': None, 'repoid': 713, 'state': 'completed', 'timestamp': datetime.datetime(2019, 2, 1, 17, 59, 47), 'updatestamp': None, 'totals': '{"C": 0, "M": 0, "N": 0, "b": 0, "c": "85.00000", "d": 0, "diff": [1, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0], "f": 3, "h": 17, "m": 3, "n": 20, "p": 0, "s": 1}', 'report': '{"files": {"awesome/__init__.py": [2, [0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0], [[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]], [0, 2, ... (483 characters truncated) ... ull, "d": 1547084427, "e": null, "f": ["unit"], "j": null, "n": null, "p": null, "t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0], "": null}}}', 'report_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_bundle_analysis_processor_task
    Test name: test_bundle_analysis_process_associate_no_parent_commit_report_object

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3cc77b60>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2106, 'branch': None, 'ci_passed': True, 'commitid': 'e188272d1f1f91ba52f48ab6a88327870a765e86', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b6465ef90>, [{'author': 2106, 'branch': None, 'ci_passed': True, 'commitid': 'e188272d1f1f91ba52f48ab6a88327870a765e86', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3ccfd2b0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3e66f9b0>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab4f40; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2106, 'branch': None, 'ci_passed': True, 'commitid': 'e188272d1f1f91ba52f48ab6a88327870a765e86', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3e66f9b0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum commit_state: "completed"
    E LINE 1: ...272d1f1f91ba52f48ab6a88327870a765e86', NULL, 715, 'completed...
    E ^

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

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

    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b3ccfee40>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3ccfd3d0>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b3c6da540>

    def test_bundle_analysis_process_associate_no_parent_commit_report_object(
    mocker,
    dbsession,
    mock_storage,
    ):
    storage_path = (
    ".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
    )
    mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

    mocker.patch.object(
    BundleAnalysisProcessorTask,
    "app",
    tasks={
    bundle_analysis_save_measurements_task_name: mocker.MagicMock(),
    },
    )

    parent_commit = CommitFactory.create(state="completed")
    dbsession.add(parent_commit)
    > dbsession.flush()

    .../tests/unit/test_bundle_analysis_processor_task.py:563:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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:1083: in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab4f40; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2106, 'branch': None, 'ci_passed': True, 'commitid': 'e188272d1f1f91ba52f48ab6a88327870a765e86', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3e66f9b0>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum commit_state: "completed"
    E LINE 1: ...272d1f1f91ba52f48ab6a88327870a765e86', NULL, 715, 'completed...
    E ^
    E
    E [SQL: INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, repoid, state, timestamp, updatestamp, totals, report, report_storage_path) VALUES (%(id)s, %(author)s, %(branch)s, %(ci_passed)s, %(commitid)s, %(deleted)s, %(message)s, %(notified)s, %(merged)s, %(parent)s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)]
    E [parameters: {'id': 1066, 'author': 2106, 'branch': None, 'ci_passed': True, 'commitid': 'e188272d1f1f91ba52f48ab6a88327870a765e86', 'deleted': None, 'message': 'Into today president treatment his tonight identify.', 'notified': None, 'merged': None, 'parent': 'e188272d1f1f91ba52f48ab6a88327870a765e86', 'pullid': None, 'repoid': 715, 'state': 'completed', 'timestamp': datetime.datetime(2019, 2, 1, 17, 59, 47), 'updatestamp': None, 'totals': '{"C": 0, "M": 0, "N": 0, "b": 0, "c": "85.00000", "d": 0, "diff": [1, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0], "f": 3, "h": 17, "m": 3, "n": 20, "p": 0, "s": 1}', 'report': '{"files": {"awesome/__init__.py": [2, [0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0], [[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]], [0, 2, ... (483 characters truncated) ... ull, "d": 1547084427, "e": null, "f": ["unit"], "j": null, "n": null, "p": null, "t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0], "": null}}}', 'report_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_bundle_analysis_processor_task
    Test name: test_bundle_analysis_processor_associate_custom_compare_sha

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3e965b20>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2112, 'branch': None, 'ci_passed': True, 'commitid': '42e0c766dae43913a37eb39e165e8419770605c6', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b6465ef90>, [{'author': 2112, 'branch': None, 'ci_passed': True, 'commitid': '42e0c766dae43913a37eb39e165e8419770605c6', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3e965700>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b4add2210>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f5d50; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2112, 'branch': None, 'ci_passed': True, 'commitid': '42e0c766dae43913a37eb39e165e8419770605c6', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b4add2210>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum commit_state: "completed"
    E LINE 1: ...c766dae43913a37eb39e165e8419770605c6', NULL, 718, 'completed...
    E ^

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

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

    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b6422ab10>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b64868bc0>
    mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f9b48943f20>

    @pytest.mark.django_db(databases={"default", "timeseries"})
    def test_bundle_analysis_processor_associate_custom_compare_sha(
    mocker,
    dbsession,
    mock_storage,
    ):
    storage_path = (
    ".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
    )
    mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

    mocker.patch.object(
    BundleAnalysisProcessorTask,
    "app",
    tasks={
    bundle_analysis_save_measurements_task_name: mocker.MagicMock(),
    },
    )

    parent_commit = CommitFactory.create(state="completed")
    dbsession.add(parent_commit)
    > dbsession.flush()

    .../tests/unit/test_bundle_analysis_processor_task.py:759:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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:1083: in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b641f5d50; closed: -1>
    statement = 'INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, rep...s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)'
    parameters = {'author': 2112, 'branch': None, 'ci_passed': True, 'commitid': '42e0c766dae43913a37eb39e165e8419770605c6', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b4add2210>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum commit_state: "completed"
    E LINE 1: ...c766dae43913a37eb39e165e8419770605c6', NULL, 718, 'completed...
    E ^
    E
    E [SQL: INSERT INTO commits (id, author, branch, ci_passed, commitid, deleted, message, notified, merged, parent, pullid, repoid, state, timestamp, updatestamp, totals, report, report_storage_path) VALUES (%(id)s, %(author)s, %(branch)s, %(ci_passed)s, %(commitid)s, %(deleted)s, %(message)s, %(notified)s, %(merged)s, %(parent)s, %(pullid)s, %(repoid)s, %(state)s, %(timestamp)s, %(updatestamp)s, %(totals)s, %(report)s, %(report_storage_path)s)]
    E [parameters: {'id': 1069, 'author': 2112, 'branch': None, 'ci_passed': True, 'commitid': '42e0c766dae43913a37eb39e165e8419770605c6', 'deleted': None, 'message': 'None cup education way.', 'notified': None, 'merged': None, 'parent': '42e0c766dae43913a37eb39e165e8419770605c6', 'pullid': None, 'repoid': 718, 'state': 'completed', 'timestamp': datetime.datetime(2019, 2, 1, 17, 59, 47), 'updatestamp': None, 'totals': '{"C": 0, "M": 0, "N": 0, "b": 0, "c": "85.00000", "d": 0, "diff": [1, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0], "f": 3, "h": 17, "m": 3, "n": 20, "p": 0, "s": 1}', 'report': '{"files": {"awesome/__init__.py": [2, [0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0], [[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]], [0, 2, ... (483 characters truncated) ... ull, "d": 1547084427, "e": null, "f": ["unit"], "j": null, "n": null, "p": null, "t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0], "": null}}}', 'report_storage_path': None}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit
    Test name: test_create_or_update_plan_known_user_with_plan

    self = <sqlalchemy.engine.base.Connection object at 0x7f9b3cc55400>
    dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f9b66c25eb0>
    constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
    statement = 'INSERT INTO owners (service, service_id, name, email, username, plan_activated_users, admins, permission, organizatio...n_user_count)s, %(stripe_customer_id)s, %(stripe_subscription_id)s, %(onboarding_completed)s) RETURNING owners.ownerid'
    parameters = {'admins': [], 'email': '[email protected]', 'free': 0, 'name': 'John Hoffman', ...}
    args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7f9b3cc545f0>, [{'admins': [], 'email': '[email protected]', 'free': 0, 'name': 'John Hoffman', ...}])
    conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7f9b3cc558e0>
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3cc57a70>

    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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab62f0; closed: -1>
    statement = 'INSERT INTO owners (service, service_id, name, email, username, plan_activated_users, admins, permission, organizatio...n_user_count)s, %(stripe_customer_id)s, %(stripe_subscription_id)s, %(onboarding_completed)s) RETURNING owners.ownerid'
    parameters = {'admins': [], 'email': '[email protected]', 'free': 0, 'name': 'John Hoffman', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3cc57a70>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E psycopg2.errors.InvalidTextRepresentation: invalid input value for enum plans: "some-plan"
    E LINE 1: ...09-19T21:04:40.802797'::timestamp, 'not_started', 'some-plan...
    E ^

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

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

    self = <worker.tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit object at 0x7f9b664feed0>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3cc57560>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b5fa66d50>

    def test_create_or_update_plan_known_user_with_plan(self, dbsession, mocker):
    owner = OwnerFactory.create(
    service="github",
    plan="some-plan",
    plan_user_count=10,
    plan_activated_users=[34123, 231, 2314212],
    stripe_customer_id="cus_123",
    stripe_subscription_id="sub_123",
    )
    dbsession.add(owner)
    repo = RepositoryFactory.create(
    private=True, service_id="12071992", activated=True, owner=owner
    )
    dbsession.add(repo)
    > dbsession.flush()

    .../tests/unit/test_ghm_sync_plans.py:88:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../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 0x7f9b66c25eb0>
    cursor = <cursor object at 0x7f9b5fab62f0; closed: -1>
    statement = 'INSERT INTO owners (service, service_id, name, email, username, plan_activated_users, admins, permission, organizatio...n_user_count)s, %(stripe_customer_id)s, %(stripe_subscription_id)s, %(onboarding_completed)s) RETURNING owners.ownerid'
    parameters = {'admins': [], 'email': '[email protected]', 'free': 0, 'name': 'John Hoffman', ...}
    context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f9b3cc57a70>

    def do_execute(self, cursor, statement, parameters, context=None):
    > cursor.execute(statement, parameters)
    E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum plans: "some-plan"
    E LINE 1: ...09-19T21:04:40.802797'::timestamp, 'not_started', 'some-plan...
    E ^
    E
    E [SQL: INSERT INTO owners (service, service_id, name, email, username, plan_activated_users, admins, permission, organizations, free, oauth_token, trial_start_date, trial_end_date, trial_status, plan, plan_user_count, stripe_customer_id, stripe_subscription_id, onboarding_completed) VALUES (%(service)s, %(service_id)s, %(name)s, %(email)s, %(username)s, %(plan_activated_users)s, %(admins)s, %(permission)s, %(organizations)s, %(free)s, %(oauth_token)s, %(trial_start_date)s, %(trial_end_date)s, %(trial_status)s, %(plan)s, %(plan_user_count)s, %(stripe_customer_id)s, %(stripe_subscription_id)s, %(onboarding_completed)s) RETURNING owners.ownerid]
    E [parameters: {'service': 'github', 'service_id': 'user2390', 'name': 'John Hoffman', 'email': '[email protected]', 'username': 'brookehancock', 'plan_activated_users': [34123, 231, 2314212], 'admins': [], 'permission': [], 'organizations': [], 'free': 0, 'oauth_token': b'NdJwlxylApLuJV1U2yZ5EDZ5r1AbPFTQHtUVVr5gSm9UFeCC+BF50hXR5R6NuDh7t68SxqT8zErtaHyRTYVuNA==', 'trial_start_date': datetime.datetime(2024, 9, 19, 21, 4, 40, 802793), 'trial_end_date': datetime.datetime(2024, 9, 19, 21, 4, 40, 802797), 'trial_status': 'not_started', 'plan': 'some-plan', 'plan_user_count': 10, 'stripe_customer_id': 'cus_123', 'stripe_subscription_id': 'sub_123', 'onboarding_completed': False}]
    E (Background on this error at: http://sqlalche..../e/13/9h9h)

    .../local/lib/python3.12.../sqlalchemy/engine/default.py:608: DataError
  • Class name: tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit
    Test name: test_create_or_update_to_free_plan_known_user

    self = <worker.tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit object at 0x7f9b664ff8f0>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3cc55f40>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b64324a70>

    def test_create_or_update_to_free_plan_known_user(self, dbsession, mocker):
    owner = OwnerFactory.create(
    service="github",
    plan="users",
    plan_user_count=2,
    plan_activated_users=[1, 2],
    )
    dbsession.add(owner)
    repo = RepositoryFactory.create(
    private=True, service_id="12071992", activated=True, owner=owner
    )
    dbsession.add(repo)
    dbsession.flush()

    ghm_service = mocker.MagicMock(get_user=mocker.MagicMock())
    SyncPlansTask().create_or_update_to_free_plan(
    dbsession, ghm_service, owner.service_id
    )

    assert not ghm_service.get_user.called
    assert owner.plan == BillingPlan.users_basic.value
    assert owner.plan_user_count == 1
    assert owner.plan_activated_users is None
    # Owner was already created, we don't update this value
    > assert owner.createstamp is None
    E assert datetime.datetime(2024, 9, 19, 21, 6, 2, 10566, tzinfo=datetime.timezone.utc) is None
    E + where datetime.datetime(2024, 9, 19, 21, 6, 2, 10566, tzinfo=datetime.timezone.utc) = Owner<2305@service<github>>.createstamp

    .../tests/unit/test_ghm_sync_plans.py:34: AssertionError
  • Class name: tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit
    Test name: test_create_or_update_to_free_plan_unknown_user

    self = <worker.tasks.tests.unit.test_ghm_sync_plans.TestGHMarketplaceSyncPlansTaskUnit object at 0x7f9b664ff380>
    dbsession = <sqlalchemy.orm.session.Session object at 0x7f9b3ccfd280>
    mocker = <pytest_mock.plugin.MockFixture object at 0x7f9b5fec98b0>

    @freeze_time("2024-03-28T00:00:00")
    def test_create_or_update_to_free_plan_unknown_user(self, dbsession, mocker):
    service_id = "12345"
    username = "tomcat"
    name = "Tom Cat"
    email = "[email protected]"
    ghm_service = mocker.MagicMock(
    get_user=mocker.MagicMock(
    return_value=dict(login=username, name=name, email=email)
    )
    )
    SyncPlansTask().create_or_update_to_free_plan(
    dbsession, ghm_service, service_id
    )

    assert ghm_service.get_user.called

    owner = (
    dbsession.query(Owner)
    .filter(Owner.service_id == service_id, Owner.service == "github")
    .first()
    )
    assert owner.username == username
    assert owner.name == name
    assert owner.email == email
    > assert owner.createstamp.isoformat() == "2024-03-28T00:00:00"
    E AssertionError: assert '2024-03-28T00:00:00+00:00' == '2024-03-28T00:00:00'
    E
    E - 2024-03-28T00:00:00
    E + 2024-03-28T00:00:00+00:00
    E & ++++++

    .../tests/unit/test_ghm_sync_plans.py:72: AssertionError
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_generate_flake_dict

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_get_test_instances_when_instance_is_failure

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_get_test_instances_when_instance_is_pass

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_get_test_instances_when_test_is_flaky

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_get_test_instances_when_test_is_flaky_and_instance_is_skip

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_creates_flakes_expires

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_creates_flakes_fail_after_merge

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_creates_flakes_from_new_branch_only

    self = <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe322d0>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('99d30f09-3201-4dd1-82b6-dbf02dab6a8b'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585951, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585951, tzinfo=datetime.timezone.utc), 1146, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe322d0>})

    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.UniqueViolation: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

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

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

    transactional_db = None

    @time_machine.travel(dt.datetime.now(tz=dt.UTC), tick=False)
    def test_it_creates_flakes_from_new_branch_only(transactional_db):
    rs = RepoSimulator()
    c1 = rs.create_commit()
    orig_branch = c1.branch
    > rs.add_test_instance(c1)

    .../tests/unit/test_process_flakes.py:239:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../tests/unit/test_process_flakes.py:52: in add_test_instance
    test=self.test_map[self.test_count],
    .../tests/unit/test_process_flakes.py:29: in <lambda>
    self.test_map = defaultdict(lambda: TestFactory(id=self.test_count))
    .../local/lib/python3.12............/site-packages/factory/base.py:40: in __call__
    return cls.create(**kwargs)
    .../local/lib/python3.12............/site-packages/factory/base.py:528: in create
    return cls._generate(enums.CREATE_STRATEGY, kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:117: in _generate
    return super()._generate(strategy, params)
    .../local/lib/python3.12............/site-packages/factory/base.py:465: in _generate
    return step.build()
    .../local/lib/python3.12.../site-packages/factory/builder.py:262: in build
    instance = self.factory_meta.instantiate(
    .../local/lib/python3.12............/site-packages/factory/base.py:317: in instantiate
    return self.factory._create(model, *args, **kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:166: in _create
    return manager.create(*args, **kwargs)
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:658: in create
    obj.save(force_insert=True, using=self.db)
    .../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:1020: in _save_table
    results = self._do_insert(
    .../local/lib/python3.12.../db/models/base.py:1061: in _do_insert
    return manager._insert(
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:1805: in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
    .../local/lib/python3.12.../models/sql/compiler.py:1822: in execute_sql
    cursor.execute(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 0x7f9b3fe322d0>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('99d30f09-3201-4dd1-82b6-dbf02dab6a8b'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585951, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585951, tzinfo=datetime.timezone.utc), 1146, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe322d0>})

    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: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_creates_flakes_from_orig_branch

    self = <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe99070>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('0e81bbe2-f776-4c47-bf65-a635b4082cc0'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585822, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585822, tzinfo=datetime.timezone.utc), 1144, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe99070>})

    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.UniqueViolation: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

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

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

    transactional_db = None

    @time_machine.travel(dt.datetime.now(tz=dt.UTC), tick=False)
    def test_it_creates_flakes_from_orig_branch(transactional_db):
    rs = RepoSimulator()
    c1 = rs.create_commit()
    orig_branch = c1.branch
    > rs.add_test_instance(c1)

    .../tests/unit/test_process_flakes.py:219:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../tests/unit/test_process_flakes.py:52: in add_test_instance
    test=self.test_map[self.test_count],
    .../tests/unit/test_process_flakes.py:29: in <lambda>
    self.test_map = defaultdict(lambda: TestFactory(id=self.test_count))
    .../local/lib/python3.12............/site-packages/factory/base.py:40: in __call__
    return cls.create(**kwargs)
    .../local/lib/python3.12............/site-packages/factory/base.py:528: in create
    return cls._generate(enums.CREATE_STRATEGY, kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:117: in _generate
    return super()._generate(strategy, params)
    .../local/lib/python3.12............/site-packages/factory/base.py:465: in _generate
    return step.build()
    .../local/lib/python3.12.../site-packages/factory/builder.py:262: in build
    instance = self.factory_meta.instantiate(
    .../local/lib/python3.12............/site-packages/factory/base.py:317: in instantiate
    return self.factory._create(model, *args, **kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:166: in _create
    return manager.create(*args, **kwargs)
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:658: in create
    obj.save(force_insert=True, using=self.db)
    .../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:1020: in _save_table
    results = self._do_insert(
    .../local/lib/python3.12.../db/models/base.py:1061: in _do_insert
    return manager._insert(
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:1805: in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
    .../local/lib/python3.12.../models/sql/compiler.py:1822: in execute_sql
    cursor.execute(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 0x7f9b3fe99070>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('0e81bbe2-f776-4c47-bf65-a635b4082cc0'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585822, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585822, tzinfo=datetime.timezone.utc), 1144, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3fe99070>})

    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: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_does_not_detect_unmerged_tests

    transactional_db = None

    def test_it_does_not_detect_unmerged_tests(transactional_db):
    rs = RepoSimulator()
    c1 = rs.create_commit()

    rs.add_test_instance(c1)

    rs.add_test_instance(c1)

    ProcessFlakesTask().run_impl(
    None, repo_id=rs.repo.repoid, commit_id_list=[c1.commitid], branch=c1.branch
    )

    > assert len(Flake.objects.all()) == 0
    E assert 3 == 0
    E + where 3 = len(<QuerySet [<Flake: Flake object (1)>, <Flake: Flake object (2)>, <Flake: Flake object (3)>]>)
    E + where <QuerySet [<Flake: Flake object (1)>, <Flake: Flake object (2)>, <Flake: Flake object (3)>]> = <bound method BaseManager.all of <django.db.models.manager.Manager object at 0x7f9b3f8c2150>>()
    E + where <bound method BaseManager.all of <django.db.models.manager.Manager object at 0x7f9b3f8c2150>> = <django.db.models.manager.Manager object at 0x7f9b3f8c2150>.all
    E + where <django.db.models.manager.Manager object at 0x7f9b3f8c2150> = Flake.objects

    .../tests/unit/test_process_flakes.py:194: AssertionError
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_handles_only_passes

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_processes_two_commits_separately

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_it_processes_two_commits_together

    self = <django.db.backends.utils.CursorWrapper object at 0x7f9b3f9fee40>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('0c9723f3-6eaf-4970-80ea-2b776c10192c'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585987, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585987, tzinfo=datetime.timezone.utc), 1150, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3f9fee40>})

    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.UniqueViolation: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

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

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

    transactional_db = None

    @time_machine.travel(dt.datetime.now(tz=dt.UTC), tick=False)
    def test_it_processes_two_commits_together(transactional_db):
    rs = RepoSimulator()
    c1 = rs.create_commit()
    rs.merge(c1)
    > rs.add_test_instance(c1, outcome=TestInstance.Outcome.FAILURE.value)

    .../tests/unit/test_process_flakes.py:292:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    .../tests/unit/test_process_flakes.py:52: in add_test_instance
    test=self.test_map[self.test_count],
    .../tests/unit/test_process_flakes.py:29: in <lambda>
    self.test_map = defaultdict(lambda: TestFactory(id=self.test_count))
    .../local/lib/python3.12............/site-packages/factory/base.py:40: in __call__
    return cls.create(**kwargs)
    .../local/lib/python3.12............/site-packages/factory/base.py:528: in create
    return cls._generate(enums.CREATE_STRATEGY, kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:117: in _generate
    return super()._generate(strategy, params)
    .../local/lib/python3.12............/site-packages/factory/base.py:465: in _generate
    return step.build()
    .../local/lib/python3.12.../site-packages/factory/builder.py:262: in build
    instance = self.factory_meta.instantiate(
    .../local/lib/python3.12............/site-packages/factory/base.py:317: in instantiate
    return self.factory._create(model, *args, **kwargs)
    .../local/lib/python3.12....../site-packages/factory/django.py:166: in _create
    return manager.create(*args, **kwargs)
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:658: in create
    obj.save(force_insert=True, using=self.db)
    .../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:1020: in _save_table
    results = self._do_insert(
    .../local/lib/python3.12.../db/models/base.py:1061: in _do_insert
    return manager._insert(
    .../local/lib/python3.12.../db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
    .../local/lib/python3.12.../db/models/query.py:1805: in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
    .../local/lib/python3.12.../models/sql/compiler.py:1822: in execute_sql
    cursor.execute(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 0x7f9b3f9fee40>
    sql = 'INSERT INTO "reports_test" ("id", "external_id", "created_at", "updated_at", "repoid", "name", "testsuite", "flags_hash", "failure_rate", "commits_where_fail") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::text[])'
    params = ('0', UUID('0c9723f3-6eaf-4970-80ea-2b776c10192c'), datetime.datetime(2024, 9, 19, 21, 4, 46, 585987, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 9, 19, 21, 4, 46, 585987, tzinfo=datetime.timezone.utc), 1150, '', ...)
    ignored_wrapper_args = (False, {'connection': <DatabaseWrapper vendor='postgresql' alias='default'>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9b3f9fee40>})

    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: duplicate key value violates unique constraint "reports_test_pkey"
    E DETAIL: Key (id)=(0) already exists.

    .../local/lib/python3.12.../db/backends/utils.py:89: IntegrityError
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_update_passed_flakes

    No failure message available
  • Class name: tasks.tests.unit.test_process_flakes
    Test name: test_upsert_failed_flakes

    No failure message available

* null constraints on installation_ids
* default yaml for owners created after a certain date
The owner.createstamp is now defaulting to now, which breaks all the tests
that assumes that we are before the patch centric YAML selection. Now force the
createstamp of the owner
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.

1 participant