def test_table_fibonacci_update_commit_or_rollback(db, generator): print("\n\ntest_table_fibonacci_update_commit_or_rollback \n\n") fib = generator.fibonacci.numbers_list() #cycle_factor = db.app.mbt_conn.cycle_factor for y in range(10): count_table_fibonacci_number=db.table_fibonacci_number.get_count_table_fibonacci_number() print('count_table_fibonacci_number=', count_table_fibonacci_number) print("\n range=", y) for x in range(10): list_table_fibonacci_numbers = [] for i_fib in fib: list_table_fibonacci_numbers.append(Table_fibonacci_number(fib_number=i_fib)) with allure.step('insert in the table the Fibonacci number %s' % fib): db.table_fibonacci_number.insert(list_table_fibonacci_numbers=list_table_fibonacci_numbers) with allure.step('update id more than number'): com_or_ron = random.randint(0, 1) if com_or_ron == 0: db.table_fibonacci_number.update_id_random() else: db.table_fibonacci_number.update_id_random(commit=False) assert(db.table_fibonacci_number.check_count()) assert (db.table_fibonacci_number.check_records())
def test_table_fn_pg_pathman_hash_with_delete_commit_or_rollback( db, generator): print( "\n\ntest_table_fn_pg_pathman_hash_with_delete_commit_or_rollback \n\n" ) if db.fn_pg_pathman_hash.get_count_table_fibonacci_number() < 100: fib = generator.fibonacci.numbers_list() for x in range(10): list_table_fibonacci_numbers = [] for i_fib in fib: list_table_fibonacci_numbers.append( Table_fibonacci_number(fib_number=i_fib)) with allure.step( 'insert in the table the table_fn_pg_pathman_hash %s' % fib): db.fn_pg_pathman_hash.insert( list_table_fibonacci_numbers=list_table_fibonacci_numbers) #test_table_fibonacci_number_with_delete #cycle_factor = db.app.mbt_conn.cycle_factor for x in range(10): with allure.step('update id more than number'): com_or_ron = random.randint(0, 1) if com_or_ron == 0: db.fn_pg_pathman_hash.delete_2_percent_of_rows() else: db.fn_pg_pathman_hash.delete_2_percent_of_rows(commit=False) assert (db.fn_pg_pathman_hash.check_count()) assert (db.fn_pg_pathman_hash.check_records())
def test_table_fn_pg_pathman_hash_multi_insert_commit_or_rollback( db, generator): print( "\n\ntest_table_fn_pg_pathman_hash_multi_insert_commit_or_rollback \n\n" ) fib = generator.fibonacci.numbers_list() list_table_fn_pg_pathman_hash = [] for i_fib in fib: list_table_fn_pg_pathman_hash.append( Table_fibonacci_number(fib_number=i_fib)) cycle_factor = db.app.mbt_conn.cycle_factor for y in range(2000 * cycle_factor): with allure.step( 'insert in the table the table_fn_pg_pathman_hash %s' % fib): com_or_ron = random.randint(0, 1) if com_or_ron == 0: db.fn_pg_pathman_hash.insert( list_table_fibonacci_numbers=list_table_fn_pg_pathman_hash) else: db.fn_pg_pathman_hash.insert( list_table_fibonacci_numbers=list_table_fn_pg_pathman_hash, commit=False) assert (db.fn_pg_pathman_hash.check_count()) assert (db.fn_pg_pathman_hash.check_records())
def test_table_fn_pg_pathman_range_id_with_delete(db, generator): print("\n\ntest_table_fn_pg_pathman_range_id_with_delete \n\n") if db.fn_pg_pathman_range_id.get_count_table_fibonacci_number() < 100: fib = generator.fibonacci.numbers_list() for x in range(10): list_table_fn_pg_pathman_range_id = [] for i_fib in fib: list_table_fn_pg_pathman_range_id.append( Table_fibonacci_number(fib_number=i_fib)) with allure.step( 'insert in the table the table_fn_pg_pathman_range_id %s' % fib): db.fn_pg_pathman_range_id.insert( list_table_fibonacci_numbers= list_table_fn_pg_pathman_range_id) #test_table_fibonacci_number_with_delete #cycle_factor = db.app.mbt_conn.cycle_factor for x in range(1): with allure.step('delete 2 percent of rows'): db.fn_pg_pathman_range_id.delete_2_percent_of_rows() assert (db.fn_pg_pathman_range_id.check_count()) assert (db.fn_pg_pathman_range_id.check_records())
def test_table_fn_autonomous_transactions_in_one_table_insert_commit_or_rollback(generator, db): print("\n\ntest_table_fn_autonomous_transactions_in_one_table_insert_commit_or_rollback \n\n") fib = generator.fibonacci.numbers_list() cycle_factor = db.app.mbt_conn.cycle_factor for x in range(20*cycle_factor): for i_fib in fib: list_table_fn_autonomous_transactions_in_one_table = [] list_table_fn_autonomous_transactions_in_one_table.append(Table_fibonacci_number(id=0, fib_number=i_fib)) with allure.step('insert in the table_fn_autonomous_transactions_in_one_table %s' % fib): com_or_ron = random.randint(0, 3) if com_or_ron == 0: db.fn_autonomous_transactions_in_one_table.autonomous_transactions_insert( list_table_fibonacci_numbers=list_table_fn_autonomous_transactions_in_one_table, count_autonomous_transactions=cycle_factor + 1) elif com_or_ron == 1: db.fn_autonomous_transactions_in_one_table.autonomous_transactions_insert( list_table_fibonacci_numbers=list_table_fn_autonomous_transactions_in_one_table, commit=False, count_autonomous_transactions=cycle_factor+1) elif com_or_ron == 2: db.fn_autonomous_transactions_in_one_table.autonomous_transactions_insert( list_table_fibonacci_numbers=list_table_fn_autonomous_transactions_in_one_table, commit_autonomous_transactions=False, count_autonomous_transactions=cycle_factor+1) else: db.fn_autonomous_transactions_in_one_table.autonomous_transactions_insert( list_table_fibonacci_numbers=list_table_fn_autonomous_transactions_in_one_table, commit=False, commit_autonomous_transactions=False, count_autonomous_transactions=cycle_factor+1) assert (db.fn_autonomous_transactions_in_one_table.check_count()) assert (db.fn_autonomous_transactions_in_one_table.check_records())
def test_table_fn_autonomous_transactions_in_one_table_update(db, generator): print("\n\ntest_table_fn_autonomous_transactions_in_one_table_update \n\n") fib = generator.fibonacci.numbers_list() list_table_fn_pg_pathman_hash = [] for i_fib in fib: list_table_fn_pg_pathman_hash.append( Table_fibonacci_number(fib_number=i_fib)) for x in range(20): with allure.step('insert in the table the Fibonacci number %s' % fib): db.fn_autonomous_transactions_in_one_table.insert( list_table_fibonacci_numbers=list_table_fn_pg_pathman_hash) #cycle_factor = db.app.mbt_conn.cycle_factor for y in range(10): count_table_fn_pg_pathman_hash = db.fn_autonomous_transactions_in_one_table.get_count_table_fibonacci_number( ) # print('count_table_fn_pg_pathman_hash=', count_table_fn_pg_pathman_hash) # print("\n range=", y) with allure.step('update id more than number'): db.fn_autonomous_transactions_in_one_table.update_id_random() assert (db.fn_autonomous_transactions_in_one_table.check_count()) assert (db.fn_autonomous_transactions_in_one_table.check_records())
def test_table_fibonacci_number_insert_commit_number_series(db, generator): print("\n\ntest_table_fibonacci_number_insert_commit_number_series \n\n") cycle_factor = db.app.mbt_conn.cycle_factor for x in range(500 * cycle_factor): list_table_fibonacci_numbers = [] list_table_fibonacci_numbers.append( Table_fibonacci_number(id=0, fib_number=x)) with allure.step('insert in the table the Fibonacci number %s' % x): db.table_fibonacci_number.insert( list_table_fibonacci_numbers=list_table_fibonacci_numbers) assert (db.table_fibonacci_number.check_count()) assert (db.table_fibonacci_number.check_records())
def test_table_fn_pg_pathman_range_id_multi_insert_commit(db, generator): print("\n\ntest_table_fn_pg_pathman_range_id_multi_insert_commit \n\n") fib = generator.fibonacci.numbers_list() list_table_fn_pg_pathman_range_id = [] for i_fib in fib: list_table_fn_pg_pathman_range_id.append(Table_fibonacci_number(fib_number=i_fib)) cycle_factor = db.app.mbt_conn.cycle_factor for y in range(1000*cycle_factor): with allure.step('insert in the table the table_fn_pg_pathman_hash %s' % fib): db.fn_pg_pathman_range_id.insert(list_table_fibonacci_numbers=list_table_fn_pg_pathman_range_id) assert(db.fn_pg_pathman_range_id.check_count()) assert (db.fn_pg_pathman_range_id.check_records())
def test_table_fn_autonomous_transactions_in_one_table_insert_commit_some_at(db, generator): print("\n\ntest_table_fn_autonomous_transactions_in_one_table_insert_commit_some_at \n\n") fib = generator.fibonacci.numbers_list() list_table_fn_autonomous_transactions_in_one_table = [] for i_fib in fib: list_table_fn_autonomous_transactions_in_one_table.append(Table_fibonacci_number(id=0, fib_number=i_fib)) cycle_factor=db.app.mbt_conn.cycle_factor for x in range(500*cycle_factor): with allure.step('insert in the test_table_fn_autonomous_transactions_in_one_table %s' % fib): db.fn_autonomous_transactions_in_one_table.autonomous_transactions_insert( list_table_fibonacci_numbers=list_table_fn_autonomous_transactions_in_one_table, count_autonomous_transactions=cycle_factor+1) assert(db.fn_autonomous_transactions_in_one_table.check_count()) assert (db.fn_autonomous_transactions_in_one_table.check_records())
def test_table_fibonacci_number_insert_commit(db, generator): print("\n\ntest_table_fibonacci_number_insert_commit \n\n") fib = generator.fibonacci.numbers_list() cycle_factor = db.app.mbt_conn.cycle_factor for x in range(5 * cycle_factor): for i_fib in fib: list_table_fibonacci_numbers = [] list_table_fibonacci_numbers.append( Table_fibonacci_number(id=0, fib_number=i_fib)) with allure.step('insert in the table the Fibonacci number %s' % fib): db.table_fibonacci_number.insert( list_table_fibonacci_numbers=list_table_fibonacci_numbers) assert (db.table_fibonacci_number.check_count()) assert (db.table_fibonacci_number.check_records())
def test_table_fn_pg_pathman_range_id_insert_commit_or_rollback(generator, db): print("\n\ntest_table_fn_pg_pathman_range_id_insert_commit_or_rollback \n\n") fib = generator.fibonacci.numbers_list() cycle_factor = db.app.mbt_conn.cycle_factor for x in range(20*cycle_factor): for i_fib in fib: list_table_fn_pg_pathman_range_id = [] list_table_fn_pg_pathman_range_id.append(Table_fibonacci_number(id=0, fib_number=i_fib)) with allure.step('insert in the table the fn_pg_pathman_hashr %s' % fib): com_or_ron = random.randint(0, 1) if com_or_ron == 0: db.fn_pg_pathman_range_id.insert(list_table_fibonacci_numbers=list_table_fn_pg_pathman_range_id) else: db.fn_pg_pathman_range_id.insert(list_table_fibonacci_numbers=list_table_fn_pg_pathman_range_id, commit=False) assert (db.fn_pg_pathman_range_id.check_count()) assert (db.fn_pg_pathman_range_id.check_records())
def create_table(self): if not self.db.table_check.check_extension_pg(sql_char="SELECT extname FROM pg_extension;", extension_pg_name='pg_pathman'): print("---- no extension pg_pathman") exit(1) global count_table_fn_pg_pathman_range_id tablename='fn_pg_pathman_range_id_'+self.db.app.mbt_conn.test_uuid self.db.fibonacci_number.create_table(table_name=tablename) list_insert=[] list_insert.append(Table_fibonacci_number(id=0, fib_number=1)) self.db.fibonacci_number.insert(list_table_fibonacci_numbers=list_insert, table_name=tablename) count_table_fn_pg_pathman_range_id += 1 list_sql_char=[] list_sql_char.append("BEGIN;") list_sql_char.append (("SELECT create_range_partitions('%s', 'id', 1, 1000);") %(tablename)) list_sql_char.append("COMMIT;") print("list_sql_char=", list_sql_char) self.db.cur_e.execute_ddl(list_sql_char=list_sql_char) return tablename