From 52c4aacad5cf8eabcad01b4b078d8fb291b2c389 Mon Sep 17 00:00:00 2001 From: Christine Lytwynec Date: Mon, 4 May 2015 10:58:25 -0400 Subject: [PATCH] Revert "Clytwynec/unique dirs for test results" --- .../paver_tests/test_paver_bok_choy_cmds.py | 12 +++++------ pavelib/tests.py | 12 ----------- pavelib/utils/envs.py | 9 -------- pavelib/utils/test/suites/nose_suite.py | 13 +----------- scripts/all-tests.sh | 21 +++++++++++++++---- scripts/jenkins-report.sh | 7 ++----- 6 files changed, 25 insertions(+), 49 deletions(-) diff --git a/pavelib/paver_tests/test_paver_bok_choy_cmds.py b/pavelib/paver_tests/test_paver_bok_choy_cmds.py index bd57345085..90a8269d6e 100644 --- a/pavelib/paver_tests/test_paver_bok_choy_cmds.py +++ b/pavelib/paver_tests/test_paver_bok_choy_cmds.py @@ -14,21 +14,19 @@ class TestPaverBokChoyCmd(unittest.TestCase): def _expected_command(self, expected_text_append, expected_default_store=None): if expected_text_append: expected_text_append = "/" + expected_text_append - shard = os.environ.get('SHARD') expected_statement = ( "DEFAULT_STORE={default_store} " - "SCREENSHOT_DIR='{repo_dir}/test_root/log{shard_str}' " - "BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log{shard_str}/hars' " - "SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log{shard_str}' " + "SCREENSHOT_DIR='{repo_dir}/test_root/log' " + "BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' " + "SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' " "nosetests {repo_dir}/common/test/acceptance/tests{exp_text} " "--with-xunit " - "--xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml " - "--verbosity=2 " + "--xunit-file={repo_dir}/reports/bok_choy/xunit.xml " + "--verbosity=2" ).format( default_store=expected_default_store, repo_dir=REPO_DIR, exp_text=expected_text_append, - shard_str='/shard_' + shard if shard else '', ) return expected_statement.strip() diff --git a/pavelib/tests.py b/pavelib/tests.py index 1b7d999caf..6d155d777f 100644 --- a/pavelib/tests.py +++ b/pavelib/tests.py @@ -212,18 +212,6 @@ def coverage(options): call_task('diff_coverage', options=dict(options)) -@task -@needs('pavelib.prereqs.install_prereqs') -def combine_coverage(): - """ - Combine coverage reports. - """ - for directory in Env.LIB_TEST_DIRS + ['cms', 'lms']: - report_dir = Env.REPORT_DIR / directory - if report_dir.isdir(): - sh("cd {} && coverage combine".format(report_dir)) - - @task @needs('pavelib.prereqs.install_prereqs') @cmdopts([ diff --git a/pavelib/utils/envs.py b/pavelib/utils/envs.py index b8743b70bf..855cfa1b58 100644 --- a/pavelib/utils/envs.py +++ b/pavelib/utils/envs.py @@ -28,15 +28,6 @@ class Env(object): BOK_CHOY_REPORT_DIR = REPORT_DIR / "bok_choy" BOK_CHOY_COVERAGERC = BOK_CHOY_DIR / ".coveragerc" - # If set, put reports for run in "unique" directories. - # The main purpose of this is to ensure that the reports can be 'slurped' - # in the main jenkins flow job without overwriting the reports from other - # build steps. For local development/testing, this shouldn't be needed. - if os.environ.get("SHARD", None): - shard_str = "shard_{}".format(os.environ.get("SHARD")) - BOK_CHOY_REPORT_DIR = BOK_CHOY_REPORT_DIR / shard_str - BOK_CHOY_LOG_DIR = BOK_CHOY_LOG_DIR / shard_str - # For the time being, stubs are used by both the bok-choy and lettuce acceptance tests # For this reason, the stubs package is currently located in the Django app called "terrain" # where other lettuce configuration is stored. diff --git a/pavelib/utils/test/suites/nose_suite.py b/pavelib/utils/test/suites/nose_suite.py index c0597e668c..ac6f069ba8 100644 --- a/pavelib/utils/test/suites/nose_suite.py +++ b/pavelib/utils/test/suites/nose_suite.py @@ -21,15 +21,6 @@ class NoseTestSuite(TestSuite): self.fail_fast = kwargs.get('fail_fast', False) self.run_under_coverage = kwargs.get('with_coverage', True) self.report_dir = Env.REPORT_DIR / self.root - - # If set, put reports for run in "unique" directories. - # The main purpose of this is to ensure that the reports can be 'slurped' - # in the main jenkins flow job without overwriting the reports from other - # build steps. For local development/testing, this shouldn't be needed. - if os.environ.get("SHARD", None): - shard_str = "shard_{}".format(os.environ.get("SHARD")) - self.report_dir = self.report_dir / shard_str - self.test_id_dir = Env.TEST_DIR / self.root self.test_ids = self.test_id_dir / 'noseids' self.extra_args = kwargs.get('extra_args', '') @@ -121,14 +112,12 @@ class SystemTestSuite(NoseTestSuite): def cmd(self): cmd = ( './manage.py {system} test --verbosity={verbosity} ' - '{test_id} {test_opts} --traceback --settings=test {extra} ' - '--with-xunit --xunit-file={xunit_report}'.format( + '{test_id} {test_opts} --traceback --settings=test {extra}'.format( system=self.root, verbosity=self.verbosity, test_id=self.test_id, test_opts=self.test_options_flags, extra=self.extra_args, - xunit_report=self.report_dir / "nosetests.xml", ) ) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index f5e15d7a4f..f73a4bd3da 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -98,12 +98,14 @@ END "unit") case "$SHARD" in "lms") - SHARD=1 paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } + paver test_system -s lms --extra_args="--with-flaky" || { EXIT=1; } + paver coverage ;; "cms-js-commonlib") - SHARD=1 paver test_system -s cms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } - SHARD=1 paver test_js --coverage --skip_clean || { EXIT=1; } - SHARD=1 paver test_lib --skip_clean --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } + paver test_system -s cms --extra_args="--with-flaky" || { EXIT=1; } + paver test_js --coverage --skip_clean || { EXIT=1; } + paver test_lib --skip_clean --extra_args="--with-flaky" || { EXIT=1; } + paver coverage ;; *) paver test --extra_args="--with-flaky" @@ -208,4 +210,15 @@ END END ;; esac + + # Move the reports to a directory that is unique to the shard + # so that when they are 'slurped' to the main flow job, they + # do not conflict with and overwrite reports from other shards. + mv reports/ reports_tmp/ + mkdir -p reports/${TEST_SUITE}/${SHARD} + mv reports_tmp/* reports/${TEST_SUITE}/${SHARD} + rm -r reports_tmp/ + exit $EXIT + ;; + esac diff --git a/scripts/jenkins-report.sh b/scripts/jenkins-report.sh index 8a43df2a5b..85bc3d1b79 100755 --- a/scripts/jenkins-report.sh +++ b/scripts/jenkins-report.sh @@ -1,11 +1,8 @@ #!/usr/bin/env bash source scripts/jenkins-common.sh -# Combine the data files that were generated using -p -paver combine_coverage - -# Get the diff coverage and html reports for unit tests -paver coverage +# Run coverage again to get the diff coverage report +paver diff_coverage # JUnit test reporter will fail the build # if it thinks test results are old