The tests started failing due to a break in demo_server dependencies.

This change implements the following:
1) Resolve flask import issue - pin dependency to an earlier version.
2) Add more debugging output to the quick start script to be able to
diagnose similar failures from build logs.
This commit is contained in:
marina-p 2022-02-22 23:08:30 -08:00 коммит произвёл GitHub
Родитель fec027c320
Коммит 0161e6cb50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -1,4 +1,6 @@
flask==1.1.2 flask==1.1.2
flask-restplus==0.13.0 flask-restplus==0.13.0
Flask-SQLAlchemy==2.5.1 Flask-SQLAlchemy==2.5.1
itsdangerous==2.0.1
Werkzeug==0.16.0 Werkzeug==0.16.0

Просмотреть файл

@ -12,6 +12,7 @@ import sys
import os import os
import subprocess import subprocess
import shutil import shutil
import glob
from pathlib import Path from pathlib import Path
RESTLER_WORKING_DIR = 'restler_working_dir' RESTLER_WORKING_DIR = 'restler_working_dir'
@ -27,6 +28,7 @@ if __name__ == '__main__':
demo_server_process = subprocess.Popen([sys.executable, demo_server_path], demo_server_process = subprocess.Popen([sys.executable, demo_server_path],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
os.chdir(curr) os.chdir(curr)
swagger_path = Path('demo_server', 'swagger.json') swagger_path = Path('demo_server', 'swagger.json')
@ -41,7 +43,7 @@ if __name__ == '__main__':
) )
# Kill demo server # Kill demo server
demo_server_process.terminate() demo_server_process.terminate()
demo_server_out, _ = demo_server_process.communicate()
# Check if restler-quick-start succeeded # Check if restler-quick-start succeeded
if output.stderr: if output.stderr:
raise QuickStartFailedException(f"Failing because stderr was detected after running restler-quick-start:\n{output.stderr!s}") raise QuickStartFailedException(f"Failing because stderr was detected after running restler-quick-start:\n{output.stderr!s}")
@ -51,11 +53,27 @@ if __name__ == '__main__':
raise QuickStartFailedException(f"Failing because restler-quick-start exited with a non-zero return code: {output.returncode!s}") raise QuickStartFailedException(f"Failing because restler-quick-start exited with a non-zero return code: {output.returncode!s}")
stdout = str(output.stdout) stdout = str(output.stdout)
if 'Request coverage (successful / total): 6 / 6' not in stdout or\ if 'Request coverage (successful / total): 6 / 6' not in stdout or\
'No bugs were found.' not in stdout or\ 'No bugs were found.' not in stdout or\
'Task Test succeeded.' not in stdout: 'Task Test succeeded.' not in stdout:
print(f"Demo server output: {demo_server_out}")
stdout = stdout.replace('\\r\\n', '\r\n') stdout = stdout.replace('\\r\\n', '\r\n')
raise QuickStartFailedException(f"Failing because expected output was not found:\n{stdout}") # Print the engine logs to the console
out_file_path = os.path.join(curr, RESTLER_WORKING_DIR, 'Test', 'EngineStdOut.txt')
err_file_path = os.path.join(curr, RESTLER_WORKING_DIR, 'Test', 'EngineStdErr.txt')
results_dir = os.path.join(curr, RESTLER_WORKING_DIR, 'Test', 'RestlerResults')
# Return the newest experiments directory in RestlerResults
net_log_dir = max(glob.glob(os.path.join(results_dir, 'experiment*/')), key=os.path.getmtime)
net_log_path = glob.glob(os.path.join(net_log_dir, 'logs', f'network.testing.*.1.txt'))[0]
with open(out_file_path) as of, open(err_file_path) as ef, open(net_log_path) as nf:
out = of.read()
err = ef.read()
net_log = nf.read()
raise QuickStartFailedException(f"Failing because expected output was not found:\n{stdout}{out}{err}{net_log}")
finally: finally:
# Delete the working directory that was created during restler quick start # Delete the working directory that was created during restler quick start
shutil.rmtree(RESTLER_WORKING_DIR) shutil.rmtree(RESTLER_WORKING_DIR)