Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+z+qYpt+PEGnZgc4ArX5/T1g+ePAYoGcxOEVizXyIf8=; b=XrZ/Ulvo+QaauzW4pRFi7Ddvg6Tsvd9xZ10AzVExpcBfnHhIClf5jVCqBxBaa4H4HN /8AP5k0uzldsdG3i1o62Y7VuuMYHMhsCzbm3iiGchiyi01bT3xxrqPUUq7cZQ6n4+3E8 jrLD4sa1PJWm59i41NAD3jhmlKsKgSTz5mxjh+9abh8aRg0qY3pkr7Be66RShIs99Z4t ZDvzdyBXWtVbArU6U/4tCepxkh9Cp/eQcFK7tIEJ9PT1D1eTjKMU9Ud9OLZ0T3t4RkP2 Mc4ZqfObc2Vs1R9FvxB5vD29SNtvVUOegPoc02gUDZlytXJXypB3gN1X0zaGmhs8NSV0 eYKQ== From: Guilherme Campos Camargo Date: Tue, 24 Apr 2018 14:24:42 -0300 Message-Id: <20180424172451.2682-6-guicc@profusion.mobi> In-Reply-To: <20180424172451.2682-1-guicc@profusion.mobi> References: <20180424172451.2682-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 05/14] Allow working_dir and install_dirs to be different List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org The `working_dir` is where all the test assets reside and also where all the results (for instance the resulting images for the CheckScreenshot test) will be stored after the tests. The `install_dir` is where the install script can be found. `install_dir` is a required argument, while `working_dir` is optional and defaults to `install_dir`. On this patch we're also modifying fuego_test.sh to copy the required assets from the test directory to the buildzone. Signed-off-by: Guilherme Campos Camargo --- .../Functional.fuego_release_test/fuego_test.sh | 6 ++++-- .../Functional.fuego_release_test/test_run.py | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/engine/tests/Functional.fuego_release_test/fuego_test.sh b/engine/tests/Functional.fuego_release_test/fuego_test.sh index f0c872b..e87d6a4 100755 --- a/engine/tests/Functional.fuego_release_test/fuego_test.sh +++ b/engine/tests/Functional.fuego_release_test/fuego_test.sh @@ -18,11 +18,13 @@ function test_build { echo "Cloning fuego-core from ${fuego_core_repo}:${fuego_core_branch}" git clone --depth 1 --single-branch --branch "${fuego_core_branch}" \ "${fuego_core_repo}" "${fuego_release_dir}/fuego-core" - cd - + + echo "Copying assets from ${TEST_HOME} to the buildzone." + cp -r "${TEST_HOME}/screenshots" . } function test_run { - sudo -n ${TEST_HOME}/test_run.py "${fuego_release_dir}/fuego" + sudo -n "${TEST_HOME}/test_run.py" "${fuego_release_dir}/fuego" -w . if [ "${?}" = 0 ]; then report "echo ok 1 fuego release test" else diff --git a/engine/tests/Functional.fuego_release_test/test_run.py b/engine/tests/Functional.fuego_release_test/test_run.py index ed3c313..8b97bde 100755 --- a/engine/tests/Functional.fuego_release_test/test_run.py +++ b/engine/tests/Functional.fuego_release_test/test_run.py @@ -638,7 +638,12 @@ def main(): return tests_ok parser = argparse.ArgumentParser() - parser.add_argument('working_dir', help="The working directory", type=str) + parser.add_argument('install_dir', help="The directory where the install " + "script resides.", type=str) + parser.add_argument('-w', '--working_dir', help="The working directory. " + "Location of the test assets and where test results " + "will be stored. Defaults to install_dir.", + default=None, type=str) parser.add_argument('-s', '--install-script', help="The script that will be used to install the " + "docker image. Defaults to '%s'" % @@ -672,8 +677,10 @@ def main(): default=True, action='store_false') args = parser.parse_args() - LOGGER.debug("Changing working dir to '%s'", args.working_dir) - os.chdir(args.working_dir) + args.install_dir, args.working_dir = get_abs_working_dirs() + + LOGGER.debug("Changing working dir to '%s'", args.install_dir) + os.chdir(args.install_dir) container = FuegoContainer(args.install_script, args.image_name, args.container_name, args.jenkins_port, @@ -690,6 +697,10 @@ def main(): if not selenium_session.start(): return 1 + if os.getcwd != args.working_dir: + LOGGER.debug("Changing working dir to '%s'", args.working_dir) + os.chdir(args.working_dir) + COMMANDS_TO_TEST = [ # Set Selenium Browser root Visit(url=container.get_url()), -- 2.17.0