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

tests.system.test_dbapi: test_staleness failed #752

Closed

Description

@flaky-bot

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: 5d8b055
buildURL: Build Status, Sponge
status: failed

Test output
shared_instance = 
dbapi_database = 
def test_staleness(shared_instance, dbapi_database):
    """Check the DB API `staleness` option."""
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()

    before_insert = datetime.datetime.utcnow().replace(tzinfo=UTC)

    cursor.execute(
        """
INSERT INTO contacts (contact_id, first_name, last_name, email)
VALUES (1, 'first-name', 'last-name', 'test.email@example.com')
    """
    )
    conn.commit()

    conn.read_only = True
    conn.staleness = {"read_timestamp": before_insert}
    cursor.execute("SELECT * FROM contacts")
    conn.commit()
  assert len(cursor.fetchall()) == 0

E AssertionError: assert 1 == 0
E + where 1 = len([(1, 'first-name', 'last-name', 'test.email@example.com')])
E + where [(1, 'first-name', 'last-name', 'test.email@example.com')] = <bound method check_not_closed..wrapper of <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7fcdc790fd00>>()
E + where <bound method check_not_closed..wrapper of <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7fcdc790fd00>> = <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7fcdc790fd00>.fetchall

tests/system/test_dbapi.py:463: AssertionError

Activity

  1. added
    flakybot: issueAn issue filed by the Flaky Bot. Should not be added manually.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jun 17, 2022
  2. flaky-bot commented on Jun 18, 2022

    @flaky-bot
    Author

    Looks like this issue is flaky. 😟

    I'm going to leave this open and stop commenting.

    A human should fix and close this.


    When run at the same commit (5d8b055), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).

  3. added
    flakybot: flakyTells the Flaky Bot not to close or comment on this issue.
    on Jun 18, 2022
  4. added
    🚨This issue needs some love.
    and removed
    🚨This issue needs some love.
    on Jun 23, 2022
  5. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    🚨This issue needs some love.
    on Jun 27, 2022
  6. ansh0l commented on Jun 27, 2022

    @ansh0l
    Contributor

    This looks transient as discussed with @asthamohta , will monitor it for a few days, so keeping it open.

  7. flaky-bot commented on Jul 2, 2022

    @flaky-bot
    Author

    Oops! Looks like this issue is still flaky. It failed again. 😬

    I reopened the issue, but a human will need to close it again.


    commit: c077480
    buildURL: Build Status, Sponge
    status: failed

    Test output
    shared_instance = 
    dbapi_database = 
    
    def test_staleness(shared_instance, dbapi_database):
        """Check the DB API `staleness` option."""
        conn = Connection(shared_instance, dbapi_database)
        cursor = conn.cursor()
    
        before_insert = datetime.datetime.utcnow().replace(tzinfo=UTC)
    
        cursor.execute(
            """
    INSERT INTO contacts (contact_id, first_name, last_name, email)
    VALUES (1, 'first-name', 'last-name', 'test.email@example.com')
        """
        )
        conn.commit()
    
        conn.read_only = True
        conn.staleness = {"read_timestamp": before_insert}
        cursor.execute("SELECT * FROM contacts")
        conn.commit()
    
      assert len(cursor.fetchall()) == 0
    

    E AssertionError: assert 1 == 0
    E + where 1 = len([(1, 'first-name', 'last-name', 'test.email@example.com')])
    E + where [(1, 'first-name', 'last-name', 'test.email@example.com')] = <bound method check_not_closed..wrapper of <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7f8a8451c490>>()
    E + where <bound method check_not_closed..wrapper of <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7f8a8451c490>> = <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7f8a8451c490>.fetchall

    tests/system/test_dbapi.py:463: AssertionError

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

Metadata

Metadata

Labels

api: spannerIssues related to the googleapis/python-spanner API.flakybot: flakyTells the Flaky Bot not to close or comment on this issue.flakybot: issueAn issue filed by the Flaky Bot. Should not be added manually.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions