mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 21:43:06 +01:00
188 lines
6.0 KiB
Python
188 lines
6.0 KiB
Python
#coding:utf-8
|
|
#
|
|
# id: bugs.core_6441
|
|
# title: Srp plugin keeps connection after database has been removed for ~10 seconds (SS and SC).
|
|
# decription:
|
|
# 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 ...
|
|
#
|
|
# tracker_id: CORE-6441
|
|
# min_versions: ['3.0.8']
|
|
# versions: 3.0.8
|
|
# qmid: None
|
|
|
|
import pytest
|
|
from firebird.qa import db_factory, isql_act, Action
|
|
|
|
# version: 3.0.8
|
|
# resources: None
|
|
|
|
substitutions_1 = []
|
|
|
|
init_script_1 = """"""
|
|
|
|
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
|
|
|
# test_script_1
|
|
#---
|
|
#
|
|
# import os
|
|
# import sys
|
|
# import time
|
|
# import subprocess
|
|
# import shutil
|
|
# from fdb import services
|
|
#
|
|
# from fdb import services
|
|
#
|
|
# svc = services.connect(host='localhost', user = user_name, password = user_password)
|
|
# fb_home=svc.get_home_directory()
|
|
# svc.close()
|
|
#
|
|
# dbconf = os.path.join(fb_home,'databases.conf')
|
|
# dbcbak = os.path.join(fb_home,'databases.bak')
|
|
#
|
|
# try:
|
|
# del os.environ["ISC_USER"]
|
|
# except KeyError as e:
|
|
# pass
|
|
#
|
|
# #--------------------------------------------
|
|
#
|
|
# 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
|
|
#
|
|
# 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()
|
|
#
|
|
# #--------------------------------------------
|
|
#
|
|
# 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
|
|
#
|
|
# if del_name and os.path.isfile( del_name ):
|
|
# os.remove( del_name )
|
|
#
|
|
# #--------------------------------------------
|
|
#
|
|
#
|
|
# fdb_test = os.path.join(context['temp_directory'],'tmp_6441.fdb')
|
|
#
|
|
# shutil.copy2( dbconf, dbcbak )
|
|
# tmp_alias = 'self_security_6441'
|
|
#
|
|
# alias_data='''
|
|
#
|
|
# # Added temporarily for executing test core_6441.fbt
|
|
# %(tmp_alias)s = %(fdb_test)s {
|
|
# # RemoteAccess = true
|
|
# SecurityDatabase = %(tmp_alias)s
|
|
# }
|
|
# ''' % locals()
|
|
#
|
|
# f_dbconf=open( dbconf, 'a')
|
|
# f_dbconf.seek(0, 2)
|
|
# f_dbconf.write( alias_data )
|
|
# flush_and_close( f_dbconf )
|
|
#
|
|
# cleanup( (fdb_test,) )
|
|
#
|
|
# sql_init='''
|
|
# set bail on;
|
|
# set list on;
|
|
#
|
|
# create database '%(tmp_alias)s';
|
|
#
|
|
# select %(i)s as iteration_no, 'DB creation completed OK.' as msg from rdb$database;
|
|
#
|
|
# alter database set linger to 0;
|
|
# create user SYSDBA password 'QweRty' using plugin Srp;
|
|
# commit;
|
|
#
|
|
# connect 'localhost:%(tmp_alias)s' user sysdba password 'QweRty';
|
|
#
|
|
# select %(i)s as iteration_no, 'Remote connection established OK.' as msg from rdb$database;
|
|
#
|
|
# 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;
|
|
# '''
|
|
#
|
|
# 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,) )
|
|
#
|
|
# shutil.move( dbcbak, dbconf )
|
|
#
|
|
#---
|
|
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
|
|
|
|
expected_stdout_1 = """
|
|
ITERATION_NO 0
|
|
MSG DB creation completed OK.
|
|
ITERATION_NO 0
|
|
MSG Remote connection established OK.
|
|
|
|
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.version('>=3.0.8')
|
|
@pytest.mark.xfail
|
|
def test_1(db_1):
|
|
pytest.fail("Test not IMPLEMENTED")
|
|
|
|
|