Check more exit codes in upgrade tests (#5323)

We were trying to find the cause for a strange update bug. We thought
`pg_upgrade` succeeded and then were surprised that certain data was not
in the database after the upgrade. Instead `pg_upgrade` had failed
halfway through with an actionable error. It took us pretty long to
realise this.

This commit adds checking of exit codes to a lot more subprocess
executions. That should make debugging in the future much easier.
pull/5325/head
Jelte Fennema 2021-09-24 15:51:00 +02:00 committed by GitHub
parent 726b3b90a5
commit 97077c5c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@ def main(config):
def install_citus(tar_path): def install_citus(tar_path):
with utils.cd('/'): with utils.cd('/'):
subprocess.call(['tar', 'xvf', tar_path]) subprocess.run(['tar', 'xvf', tar_path], check=True)
def report_initial_version(config): def report_initial_version(config):
@ -108,7 +108,7 @@ def restart_database(pg_path, abs_data_path, node_name):
'-o', '-p {}'.format(NODE_PORTS[node_name]), '-o', '-p {}'.format(NODE_PORTS[node_name]),
'--log', os.path.join(abs_data_path, 'logfile_' + node_name) '--log', os.path.join(abs_data_path, 'logfile_' + node_name)
] ]
subprocess.call(command) subprocess.run(command, check=True)
def run_alter_citus(pg_path, mixed_mode): def run_alter_citus(pg_path, mixed_mode):

View File

@ -45,7 +45,7 @@ def perform_postgres_upgrade(old_bindir, new_bindir, old_datadir, new_datadir):
'--old-datadir', abs_old_data_path, '--old-datadir', abs_old_data_path,
'--new-datadir', abs_new_data_path '--new-datadir', abs_new_data_path
] ]
subprocess.call(command) subprocess.run(command, check=True)
def citus_finish_pg_upgrade(pg_path): def citus_finish_pg_upgrade(pg_path):

View File

@ -24,7 +24,7 @@ def initialize_temp_dir_if_not_exists(temp_dir):
os.chmod(temp_dir, 0o777) os.chmod(temp_dir, 0o777)
def initialize_db_for_cluster(pg_path, rel_data_path, settings): def initialize_db_for_cluster(pg_path, rel_data_path, settings):
subprocess.call(['mkdir', rel_data_path]) subprocess.run(['mkdir', rel_data_path], check=True)
for node_name in NODE_NAMES: for node_name in NODE_NAMES:
abs_data_path = os.path.abspath(os.path.join(rel_data_path, node_name)) abs_data_path = os.path.abspath(os.path.join(rel_data_path, node_name))
command = [ command = [
@ -32,7 +32,7 @@ def initialize_db_for_cluster(pg_path, rel_data_path, settings):
'--pgdata', abs_data_path, '--pgdata', abs_data_path,
'--username', USER '--username', USER
] ]
subprocess.call(command) subprocess.run(command, check=True)
add_settings(abs_data_path, settings) add_settings(abs_data_path, settings)
@ -56,7 +56,7 @@ def start_databases(pg_path, rel_data_path):
'-o', '-p {}'.format(NODE_PORTS[node_name]), '-o', '-p {}'.format(NODE_PORTS[node_name]),
'--log', os.path.join(abs_data_path, 'logfile_' + node_name) '--log', os.path.join(abs_data_path, 'logfile_' + node_name)
] ]
subprocess.call(command) subprocess.run(command, check=True)
def create_citus_extension(pg_path): def create_citus_extension(pg_path):
for port in NODE_PORTS.values(): for port in NODE_PORTS.values():