googleapis / python-spanner

Apache License 2.0
137 stars 88 forks source link

tests.system.test_session_api: test_execute_partitioned_dml failed #1029

Closed flaky-bot[bot] closed 1 year ago

flaky-bot[bot] commented 1 year ago

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: b534a8aac116a824544d63a24e38f3d484e0d207 buildURL: Build Status, Sponge status: failed

Test output
sessions_database = 
database_dialect = 

    def test_execute_partitioned_dml(sessions_database, database_dialect):
        # [START spanner_test_dml_partioned_dml_update]
        sd = _sample_data
        param_types = spanner_v1.param_types

        delete_statement = f"DELETE FROM {sd.TABLE} WHERE true"

        def _setup_table(txn):
            txn.execute_update(delete_statement)
            for insert_statement in _generate_insert_statements():
                txn.execute_update(insert_statement)

        committed = sessions_database.run_in_transaction(_setup_table)

        with sessions_database.snapshot(read_timestamp=committed) as snapshot:
            before_pdml = list(snapshot.read(sd.TABLE, sd.COLUMNS, sd.ALL))

        sd._check_rows_data(before_pdml)

        keys = (
            ["p1", "p2"]
            if database_dialect == DatabaseDialect.POSTGRESQL
            else ["email", "target"]
        )
        placeholders = (
            ["$1", "$2"]
            if database_dialect == DatabaseDialect.POSTGRESQL
            else [f"@{key}" for key in keys]
        )
        nonesuch = "nonesuch@example.com"
        target = "phred@example.com"
        update_statement = (
            f"UPDATE contacts SET email = {placeholders[0]} WHERE email = {placeholders[1]}"
        )

        row_count = sessions_database.execute_partitioned_dml(
            update_statement,
            params={keys[0]: nonesuch, keys[1]: target},
            param_types={keys[0]: param_types.STRING, keys[1]: param_types.STRING},
            request_options=spanner_v1.RequestOptions(
                priority=spanner_v1.RequestOptions.Priority.PRIORITY_MEDIUM
            ),
        )
        assert row_count == 1

        row = sd.ROW_DATA[0]
        updated = [row[:3] + (nonesuch,)] + list(sd.ROW_DATA[1:])

        with sessions_database.snapshot(read_timestamp=committed) as snapshot:
            after_update = list(snapshot.read(sd.TABLE, sd.COLUMNS, sd.ALL))
        sd._check_rows_data(after_update, updated)

        row_count = sessions_database.execute_partitioned_dml(delete_statement)
>       assert row_count == len(sd.ROW_DATA)
E       AssertionError: assert 0 == 3
E        +  where 3 = len(((1, 'Phred', 'Phlyntstone', 'phred@example.com'), (2, 'Bharney', 'Rhubble', 'bharney@example.com'), (3, 'Wylma', 'Phlyntstone', 'wylma@example.com')))
E        +    where ((1, 'Phred', 'Phlyntstone', 'phred@example.com'), (2, 'Bharney', 'Rhubble', 'bharney@example.com'), (3, 'Wylma', 'Phlyntstone', 'wylma@example.com')) = .ROW_DATA

tests/system/test_session_api.py:1180: AssertionError
flaky-bot[bot] commented 1 year ago

Looks like this issue is flaky. :worried:

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

A human should fix and close this.


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