6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_6441_test.py

180 lines
5.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-2367
ISSUE: 2367
TITLE: Srp plugin keeps connection after database has been removed for ~10 seconds (SS and SC)
DESCRIPTION:
Test is based on CORE-6412, but instead of complex DDL it only creates DB and makes connection.
Then it leaves ISQL and 'main' code changes DB state to full shutdown and removes database.
After this, test immediatelly starts next iteration with the same actions. All of them must pass.
Total number of iterations = 3.
Confirmed bug on 4.0.0.2265:
Statement failed, SQLSTATE = 08006
Error occurred during login, please check server firebird.log for details
Error occurred during login, please check server firebird.log for details
NB. Content of firebird.log will be added with following lines:
Srp Server
connection shutdown
Database is shutdown.
This is expected (got reply from Alex, e-mail 19.11.2020 11:12).
Checked on 3.0.8.33392 SS/SC, 4.0.0.2269 SC/SS - all fine.
03-mar-2021: fixed call syntax in runProgram() macros.
Checked on:
* WINDOWS: 335544344 : I/O error during "CreateFile (open)" operation ...
* LINUX: 335544344 : I/O error during "open" operation ...
JIRA: CORE-6441
FBTEST: bugs.core_6441
2022-01-27 20:08:36 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-27 20:08:36 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
expected_stdout = """
ITERATION_NO 0
MSG DB creation completed OK.
ITERATION_NO 0
MSG Remote connection established OK.
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
ITERATION_NO 1
MSG DB creation completed OK.
ITERATION_NO 1
MSG Remote connection established OK.
ITERATION_NO 2
MSG DB creation completed OK.
ITERATION_NO 2
MSG Remote connection established OK.
"""
@pytest.mark.skip('FIXME: databases.conf')
@pytest.mark.version('>=3.0.8')
def test_1(act: Action):
pytest.fail("Not IMPLEMENTED")
2021-04-26 20:07:00 +02:00
# test_script_1
#---
#
2021-04-26 20:07:00 +02:00
# import os
# import sys
# import time
# import subprocess
# import shutil
# from fdb import services
#
2021-04-26 20:07:00 +02:00
# from fdb import services
#
2021-04-26 20:07:00 +02:00
# svc = services.connect(host='localhost', user = user_name, password = user_password)
# fb_home=svc.get_home_directory()
# svc.close()
#
2021-04-26 20:07:00 +02:00
# dbconf = os.path.join(fb_home,'databases.conf')
# dbcbak = os.path.join(fb_home,'databases.bak')
#
2021-04-26 20:07:00 +02:00
# try:
# del os.environ["ISC_USER"]
# except KeyError as e:
# pass
#
2021-04-26 20:07:00 +02:00
# #--------------------------------------------
#
2021-04-26 20:07:00 +02:00
# def flush_and_close( file_handle ):
# # https://docs.python.org/2/library/os.html#os.fsync
# # If you're starting with a Python file object f,
# # first do f.flush(), and
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
# global os
#
2021-04-26 20:07:00 +02:00
# file_handle.flush()
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
# os.fsync(file_handle.fileno())
# file_handle.close()
#
2021-04-26 20:07:00 +02:00
# #--------------------------------------------
#
2021-04-26 20:07:00 +02:00
# def cleanup( f_names_list ):
# global os
# for i in range(len( f_names_list )):
# if type(f_names_list[i]) == file:
# del_name = f_names_list[i].name
# elif type(f_names_list[i]) == str:
# del_name = f_names_list[i]
# else:
# print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.')
# del_name = None
#
2021-04-26 20:07:00 +02:00
# if del_name and os.path.isfile( del_name ):
# os.remove( del_name )
#
2021-04-26 20:07:00 +02:00
# #--------------------------------------------
#
#
2021-04-26 20:07:00 +02:00
# fdb_test = os.path.join(context['temp_directory'],'tmp_6441.fdb')
#
2021-04-26 20:07:00 +02:00
# shutil.copy2( dbconf, dbcbak )
# tmp_alias = 'self_security_6441'
#
2021-04-26 20:07:00 +02:00
# alias_data='''
#
2021-04-26 20:07:00 +02:00
# # Added temporarily for executing test core_6441.fbt
# %(tmp_alias)s = %(fdb_test)s {
# # RemoteAccess = true
# SecurityDatabase = %(tmp_alias)s
# }
# ''' % locals()
#
2021-04-26 20:07:00 +02:00
# f_dbconf=open( dbconf, 'a')
# f_dbconf.seek(0, 2)
# f_dbconf.write( alias_data )
# flush_and_close( f_dbconf )
#
2021-04-26 20:07:00 +02:00
# cleanup( (fdb_test,) )
#
2021-04-26 20:07:00 +02:00
# sql_init='''
# set bail on;
# set list on;
#
2021-04-26 20:07:00 +02:00
# create database '%(tmp_alias)s';
#
2021-04-26 20:07:00 +02:00
# select %(i)s as iteration_no, 'DB creation completed OK.' as msg from rdb$database;
#
2021-04-26 20:07:00 +02:00
# alter database set linger to 0;
# create user SYSDBA password 'QweRty' using plugin Srp;
# commit;
#
2021-04-26 20:07:00 +02:00
# connect 'localhost:%(tmp_alias)s' user sysdba password 'QweRty';
#
2021-04-26 20:07:00 +02:00
# select %(i)s as iteration_no, 'Remote connection established OK.' as msg from rdb$database;
#
2021-04-26 20:07:00 +02:00
# set term ^;
# execute block as
# declare v_dummy varchar(20);
# begin
# select left(a.mon$remote_protocol,3) as mon_protocol
# from mon$attachments a
# where a.mon$attachment_id = current_connection
# into v_dummy;
# end
# ^
# set term ;^
# quit;
# '''
#
2021-04-26 20:07:00 +02:00
# for i in range(0,3):
# runProgram('isql',[ '-q' ], sql_init % locals() )
# runProgram('gfix',[ '-shut', 'full', '-force', '0', 'localhost:' + fdb_test, '-user', 'SYSDBA', '-pas', 'QweRty' ])
# cleanup( (fdb_test,) )
#
2021-04-26 20:07:00 +02:00
# shutil.move( dbcbak, dbconf )
#
2021-04-26 20:07:00 +02:00
#---