Skip to content

Commit

Permalink
Add test for combocid handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Knizhnik committed Jul 25, 2024
1 parent 18f5874 commit b20f670
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test_runner/regress/test_combocid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from fixtures.neon_fixtures import NeonEnvBuilder


def test_combocid(neon_env_builder: NeonEnvBuilder):
env = neon_env_builder.init_start()
endpoint = env.endpoints.create_start("main")

conn = endpoint.connect()
cur = conn.cursor()
n_records = 100000

cur.execute("create table t(id integer, val integer)")
cur.execute(f"insert into t values (generate_series(1,{n_records}), 0)")

cur.execute("begin")

cur.execute("update t set val=val+1")
assert cur.rowcount == n_records
cur.execute("update t set val=val+1")
assert cur.rowcount == n_records
cur.execute("update t set val=val+1")
assert cur.rowcount == n_records

cur.execute("delete from t")
assert cur.rowcount == n_records
cur.execute("delete from t")
assert cur.rowcount == 0

cur.execute(f"insert into t values (generate_series(1,{n_records}), 0)")
cur.execute("update t set val=val+1")
assert cur.rowcount == n_records
cur.execute("update t set val=val+1")
assert cur.rowcount == n_records
cur.execute("update t set val=val+1")
assert cur.rowcount == n_records

cur.execute("rollback")

0 comments on commit b20f670

Please sign in to comment.