From 4d35f85b87a5e55bc72f052a367750807ea329c2 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 27 Apr 2023 12:18:44 +0200 Subject: [PATCH] Fix behave tests (#2656) 1. specify `subjectAltName=IP:127.0.0.1` when generating certificate 2. run more behave tests with psycopg2 --- .github/workflows/install_deps.py | 6 +++--- features/environment.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/install_deps.py b/.github/workflows/install_deps.py index 82f0a6cc..29acb701 100644 --- a/.github/workflows/install_deps.py +++ b/.github/workflows/install_deps.py @@ -19,7 +19,7 @@ def install_requirements(what): requirements = ['mock>=2.0.0', 'flake8', 'pytest', 'pytest-cov'] if what == 'all' else ['behave'] requirements += ['coverage'] # try to split tests between psycopg2 and psycopg3 - requirements += ['psycopg[binary]'] if sys.version_info > (3, 7, 0) and\ + requirements += ['psycopg[binary]'] if sys.version_info >= (3, 8, 0) and\ (sys.platform != 'darwin' or what == 'etcd3') else ['psycopg2-binary'] for r in read('requirements.txt').split('\n'): r = r.strip() @@ -85,8 +85,8 @@ def unzip_all(archive): def chmod_755(name): - os.chmod(name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + os.chmod(name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR + | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) def unpack(archive, name): diff --git a/features/environment.py b/features/environment.py index bb677026..b915fd99 100644 --- a/features/environment.py +++ b/features/environment.py @@ -1060,7 +1060,8 @@ def before_all(context): try: with open(os.devnull, 'w') as null: ret = subprocess.call(['openssl', 'req', '-nodes', '-new', '-x509', '-subj', '/CN=batman.patroni', - '-keyout', context.keyfile, '-out', context.certfile], stdout=null, stderr=null) + '--addext', 'subjectAltName=IP:127.0.0.1', '-keyout', context.keyfile, + '-out', context.certfile], stdout=null, stderr=null) if ret != 0: raise Exception except Exception: