From ad061c886bfffbf48958a381562299c5f2bc1215 Mon Sep 17 00:00:00 2001 From: checktheroads Date: Sun, 16 Jun 2019 20:53:09 -0700 Subject: [PATCH] moved starting flask to bash script --- .travis.yml | 2 +- ci/{ci_test_prepare.py => ci_dev_server.py} | 27 --------------------- ci/ci_prepare.sh | 13 ++++++++++ 3 files changed, 14 insertions(+), 28 deletions(-) rename ci/{ci_test_prepare.py => ci_dev_server.py} (54%) create mode 100644 ci/ci_prepare.sh diff --git a/.travis.yml b/.travis.yml index 6a73e2f..03d9d5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ install: after_install: - bash ./ci/check_code.sh before_script: - - nohup python3 ./ci/ci_test_prepare.py & + - bash ./ci/ci_prepare.sh script: - python3 ./ci/ci_test.py after_script: diff --git a/ci/ci_test_prepare.py b/ci/ci_dev_server.py similarity index 54% rename from ci/ci_test_prepare.py rename to ci/ci_dev_server.py index b7158c7..e03af25 100755 --- a/ci/ci_test_prepare.py +++ b/ci/ci_dev_server.py @@ -11,33 +11,6 @@ working_directory = os.path.dirname(os.path.abspath(__file__)) parent_directory = os.path.dirname(working_directory) -def ci_config(): - """Copies test configuration files to usable config files""" - logger.info("Migrating test config files...") - config_dir = os.path.join(parent_directory, "hyperglass/configuration/") - test_files = glob.iglob(os.path.join(working_directory, "*.toml")) - config_files = glob.iglob(os.path.join(config_dir, "*.toml")) - logger.debug(config_dir) - logger.debug(working_directory) - logger.debug(parent_directory) - status = False - for f in config_files: - if os.path.exists(f): - logger.debug(f"{f} already exists") - os.remove(f) - logger.debug(f"Deleted {f}") - for f in test_files: - try: - shutil.copy(f, config_dir) - logger.debug(f"Copied {f}") - logger.info("Successfully migrated test config files") - status = True - except: - logger.error(f"Failed to migrate {f}") - raise - return status - - def construct_test(test_query, location, test_target): """Constructs JSON POST data for test_hyperglass function""" constructed_query = json.dumps( diff --git a/ci/ci_prepare.sh b/ci/ci_prepare.sh new file mode 100644 index 0000000..e3754a9 --- /dev/null +++ b/ci/ci_prepare.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +copy_config() { + rm ../hyperglass/configuration/*.toml + cp *.toml ../hyperglass/configuration/ +} + +start_flask() { + nohup python3 ./ci_dev_server.py & +} + +copy_config() +start_flask()