2 @message |
IndexError: list index out of range
LOG DETAILS:
2024-05-12 19:15:55.447
2024-05-12 19:15:55.452 act = <firebird.qa.plugin.Action object at [hex]>
2024-05-12 19:15:55.457 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-05-12 19:15:55.462
2024-05-12 19:15:55.467 @pytest.mark.version('>=3.0.6')
2024-05-12 19:15:55.473 def test_1(act: Action, capsys):
2024-05-12 19:15:55.477
2024-05-12 19:15:55.482
2024-05-12 19:15:55.487 with act.trace(db_events=trace):
2024-05-12 19:15:55.492 with act.db.connect() as con_aux:
2024-05-12 19:15:55.496 with act.db.connect() as con:
2024-05-12 19:15:55.501 cur = con.cursor()
2024-05-12 19:15:55.506 con.execute_immediate('insert into test(x) values(123)')
2024-05-12 19:15:55.510 con.commit(retaining = True) # (TRA_12, ... ; next line: "New number 13"
2024-05-12 19:15:55.515 cur.callproc('sp_worker', [456]) # (TRA_13, INIT_12, ...
2024-05-12 19:15:55.520 con.commit(retaining = True) # (TRA_13, INIT_12, ... ; next line: "New number 14"
2024-05-12 19:15:55.525 con.execute_immediate('delete from test') # (TRA_14, INIT_12, ...
2024-05-12 19:15:55.530 con.commit(retaining = True) # (TRA_14, INIT_12, ... ; next line: "New number 15"
2024-05-12 19:15:55.535
2024-05-12 19:15:55.541 # Process trace
2024-05-12 19:15:55.545 tx_base = -1
2024-05-12 19:15:55.551 tx_init_set = set() # at finish it must contain only one element
2024-05-12 19:15:55.556 tx_for_subsequent_changes = -1
2024-05-12 19:15:55.561 for line in act.trace_log:
2024-05-12 19:15:55.567 if line.rstrip().split():
2024-05-12 19:15:55.573 #print(line.strip())
2024-05-12 19:15:55.578 for p in allowed_patterns:
2024-05-12 19:15:55.583 if p.search(line):
2024-05-12 19:15:55.588 print(line.strip())
2024-05-12 19:15:55.593
2024-05-12 19:15:55.598 if '(TRA_' in line:
2024-05-12 19:15:55.603 words = line.replace(',',' ').replace('_',' ').replace('(',' ').split()
2024-05-12 19:15:55.608 # Result:
2024-05-12 19:15:55.612 # 1) for tx WITHOUT retaining: ['TRA', '12', 'READ', 'COMMITTED', '|', 'REC', 'VERSION', '|', 'WAIT', '|', 'READ', 'WRITE)']
2024-05-12 19:15:55.617 # 2) for tx which is RETAINED: ['TRA', '13', 'INIT', '12', 'READ', 'COMMITTED', '|', 'REC', 'VERSION', '|', 'WAIT', '|', 'READ', 'WRITE)']
2024-05-12 19:15:55.622 # 0 1 2 3
2024-05-12 19:15:55.627 tx_base = int(words[1]) if tx_base == -1 else tx_base
2024-05-12 19:15:55.632 if words[2] == 'INIT':
2024-05-12 19:15:55.636
2024-05-12 19:15:55.641 tx_init_set.add( int(words[3]) )
2024-05-12 19:15:55.646 assert len(tx_init_set) == 1, 'Multiple transactions are specified in "INIT_nnn" tags in the trace: {tx_init_set}'
2024-05-12 19:15:55.652
2024-05-12 19:15:55.660 tx_that_finished_now = int(words[1])
2024-05-12 19:15:55.665 assert tx_that_finished_now == tx_for_subsequent_changes, 'Finished Tx: {tx_that_finished_now} - NOT equals to "New number": {tx_for_subsequent_changes}'
2024-05-12 19:15:55.670
2024-05-12 19:15:55.675 #tx_origin_of_changes = int(words[3]) - tx_base
2024-05-12 19:15:55.680 #tx_that_finished_now = int(words[1]) - tx_base
2024-05-12 19:15:55.685 # print('Found "INIT_" token in "TRA_" record. Tx that is origin of changes: ', tx_origin_of_changes, '; Tx that finished now:', tx_that_finished_now)
2024-05-12 19:15:55.690 elif 'number' in line:
2024-05-12 19:15:55.695 tx_for_subsequent_changes = int(line.split()[2]) # 'New number 15' --> 15
2024-05-12 19:15:55.701 tx_base = tx_for_subsequent_changes if tx_base < 0 else tx_base
2024-05-12 19:15:55.706 # print('Found record with "NEW NUMBER" for subsequent Tx numbers: ', tx_for_subsequent_changes)
2024-05-12 19:15:55.711
2024-05-12 19:15:55.716
2024-05-12 19:15:55.721 expected_stdout = f"""
2024-05-12 19:15:55.725 New number {tx_base}
2024-05-12 19:15:55.732 > (TRA_{tx_base}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
2024-05-12 19:15:55.737 New number {tx_base+1}
2024-05-12 19:15:55.744 (TRA_{tx_base+1}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
2024-05-12 19:15:55.749 New number {tx_base+2}
2024-05-12 19:15:55.754 (TRA_{tx_base+2}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
2024-05-12 19:15:55.759 """
2024-05-12 19:15:55.764 E IndexError: list index out of range
2024-05-12 19:15:55.769
2024-05-12 19:15:55.773 tests/bugs/core_6095_test.py:116: IndexError
2024-05-12 19:15:55.778 ---------------------------- Captured stdout setup -----------------------------
2024-05-12 19:15:55.783 Cached db: db-12.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=3.0.6')
def test_1(act: Action, capsys):
with act.trace(db_events=trace):
with act.db.connect() as con_aux:
with act.db.connect() as con:
cur = con.cursor()
con.execute_immediate('insert into test(x) values(123)')
con.commit(retaining = True) # (TRA_12, ... ; next line: "New number 13"
cur.callproc('sp_worker', [456]) # (TRA_13, INIT_12, ...
con.commit(retaining = True) # (TRA_13, INIT_12, ... ; next line: "New number 14"
con.execute_immediate('delete from test') # (TRA_14, INIT_12, ...
con.commit(retaining = True) # (TRA_14, INIT_12, ... ; next line: "New number 15"
# Process trace
tx_base = -1
tx_init_set = set() # at finish it must contain only one element
tx_for_subsequent_changes = -1
for line in act.trace_log:
if line.rstrip().split():
#print(line.strip())
for p in allowed_patterns:
if p.search(line):
print(line.strip())
if '(TRA_' in line:
words = line.replace(',',' ').replace('_',' ').replace('(',' ').split()
# Result:
# 1) for tx WITHOUT retaining: ['TRA', '12', 'READ', 'COMMITTED', '|', 'REC', 'VERSION', '|', 'WAIT', '|', 'READ', 'WRITE)']
# 2) for tx which is RETAINED: ['TRA', '13', 'INIT', '12', 'READ', 'COMMITTED', '|', 'REC', 'VERSION', '|', 'WAIT', '|', 'READ', 'WRITE)']
# 0 1 2 3
tx_base = int(words[1]) if tx_base == -1 else tx_base
if words[2] == 'INIT':
tx_init_set.add( int(words[3]) )
assert len(tx_init_set) == 1, 'Multiple transactions are specified in "INIT_nnn" tags in the trace: {tx_init_set}'
tx_that_finished_now = int(words[1])
assert tx_that_finished_now == tx_for_subsequent_changes, 'Finished Tx: {tx_that_finished_now} - NOT equals to "New number": {tx_for_subsequent_changes}'
#tx_origin_of_changes = int(words[3]) - tx_base
#tx_that_finished_now = int(words[1]) - tx_base
# print('Found "INIT_" token in "TRA_" record. Tx that is origin of changes: ', tx_origin_of_changes, '; Tx that finished now:', tx_that_finished_now)
elif 'number' in line:
tx_for_subsequent_changes = int(line.split()[2]) # 'New number 15' --> 15
tx_base = tx_for_subsequent_changes if tx_base < 0 else tx_base
# print('Found record with "NEW NUMBER" for subsequent Tx numbers: ', tx_for_subsequent_changes)
expected_stdout = f"""
New number {tx_base}
> (TRA_{tx_base}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
New number {tx_base+1}
(TRA_{tx_base+1}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
New number {tx_base+2}
(TRA_{tx_base+2}, INIT_{list(tx_init_set)[0]}, CONCURRENCY | WAIT | READ_WRITE)
"""
E IndexError: list index out of range
tests/bugs/core_6095_test.py:116: IndexError
|