diff --git a/tests/regression/lib/Controllers/MetricExplorerSupremmChartsTest.php b/tests/regression/lib/Controllers/MetricExplorerSupremmChartsTest.php index 999927c5..3049914f 100644 --- a/tests/regression/lib/Controllers/MetricExplorerSupremmChartsTest.php +++ b/tests/regression/lib/Controllers/MetricExplorerSupremmChartsTest.php @@ -2,41 +2,18 @@ namespace RegressionTests\Controllers; -use IntegrationTests\TestHarness\Utilities; -use IntegrationTests\TestHarness\XdmodTestHelper; use RegressionTests\Controllers\MetricExplorerChartsTest; class MetricExplorerSupremmChartsTest extends MetricExplorerChartsTest { - public function filterTestsProvider() + protected static function getFilterTestBaseConfig() { - $data_file = realpath(__DIR__ . '/../../../artifacts/regression/chartFilterTests.json'); - if (file_exists($data_file)) { - $inputs = json_decode(file_get_contents($data_file), true); - } else { - // Generate test permutations. The expected values for the data points are not set. - // this causes the test function to record the values and they are then written - // to a file in the tearDownAfterClass function. - $baseConfig = array( - array('realm' => 'SUPREMM', 'metric' => 'wall_time', 'date' => '2016-12-29') - ); - - $inputs = $this->generateFilterTests($baseConfig); - } - - $helper = new XdmodTestHelper(); - $helper->authenticate('cd'); - - $enabledRealms = Utilities::getRealmsToTest(); - - $output = array(); - foreach ($inputs as $test) - { - if (in_array(strtolower($test['settings']['realm']), $enabledRealms)) { - $output[] = array($helper, $test['settings'], $test['expected']); - } - } - - return $output; + return [ + [ + 'realm' => 'SUPREMM', + 'metric' => 'wall_time', + 'date' => '2016-12-29' + ] + ]; } } diff --git a/tests/regression/lib/Controllers/UsageExplorerSupremmTest.php b/tests/regression/lib/Controllers/UsageExplorerSupremmTest.php index 70e0368a..329c5ca7 100644 --- a/tests/regression/lib/Controllers/UsageExplorerSupremmTest.php +++ b/tests/regression/lib/Controllers/UsageExplorerSupremmTest.php @@ -8,43 +8,8 @@ /** * Test the usage explorer for jobs realm regressions. */ -class UsageExplorerJobsTest extends TestCase +class UsageExplorerJobsTest extends aUsageExplorerTest { - /** - * @var RegressionTestHelper - */ - private static $helper; - - /** - * Create the helper and authenticate. - */ - public static function setUpBeforeClass(): void - { - self::$helper = new RegressionTestHelper(); - self::$helper->authenticate(); - } - - /** - * Log out and output any messages generated by tests. - */ - public static function tearDownAfterClass(): void - { - self::$helper->logout(); - self::$helper->outputMessages(); - } - - /** - * Test usage explorer CSV export. - * - * @group regression - * @group UsageExplorer - * @dataProvider csvExportProvider - */ - public function testCsvExport($testName, $input, $expectedFile, $userRole) - { - $this->assertTrue(self::$helper->checkCsvExport($testName, $input, $expectedFile, $userRole)); - } - public function csvExportProvider() { $statistics = [ diff --git a/tests/regression/phpunit.xml.dist b/tests/regression/phpunit.xml.dist index ed8332dd..c76b4027 100644 --- a/tests/regression/phpunit.xml.dist +++ b/tests/regression/phpunit.xml.dist @@ -1,9 +1,12 @@ - + diff --git a/tests/regression/runtests.sh b/tests/regression/runtests.sh index f33f78e6..bf7d871a 100755 --- a/tests/regression/runtests.sh +++ b/tests/regression/runtests.sh @@ -1,82 +1 @@ -#!/bin/bash - -set -e - -REGUSER="" -PI="" -CD="" -CS="" -PUB="" -WAREHOUSE="" - -if [ "$1" = "--junit-output-dir" ]; -then - REGUSER="--log-junit $2/xdmod-supremm-regression-user.xml" - PI="--log-junit $2/xdmod-supremm-regression-principalinvestigator.xml" - CD="--log-junit $2/xdmod-supremm-regression-centerdirector.xml" - CS="--log-junit $2/xdmod-supremm-regression-centerstaff.xml" - PUB="--log-junit $2/xdmod-supremm-regression-public.xml" - WAREHOUSE="--log-junit $2/xdmod-supremm-regression-warehouse.xml" -fi - -cd $(dirname $0) - -if [ ! -e ../../../xdmod/tests/ci/testing.json ]; -then - echo "ERROR missing .secrets.json file." >&2 - echo >&2 - cat README.md >&2 - exit 126 -fi - -phpunit="$(readlink -f ../../../xdmod/vendor/bin/phpunit)" - -if [ ! -x "$phpunit" ]; then - echo phpunit not found, run \"composer install\" 1>&2 - exit 127 -fi - -export REG_TEST_BASE=${REG_TEST_BASE:-/../../../../../xdmod-supremm/tests/artifacts/regression/current/} - -function run_warehouse_raw_data_tests { - # Need to ignore the values of deidentified usernames when comparing the - # actual and expected data because the values will be different depending - # on whether XDMOD_TEST_MODE is set to 'upgrade' or 'fresh_install' since - # these two testing pipelines produce different hashes for the usernames. - REG_TEST_USER_ROLE=usr \ - REG_TEST_REGEX='/[0-9a-f]{40}/' \ - REG_TEST_REPLACE='' \ - $phpunit $WAREHOUSE --group warehouseRawData . -} - -if [ "$REG_TEST_ALL" == "1" ]; then - set +e - REG_TEST_USER_ROLE=cd $phpunit $CD --exclude-group warehouseRawData . - - #REG_TEST_USER_ROLE=usr $phpunit $REGUSER ./lib/Controllers/UsageExplorerSupremmTest.php - #REG_TEST_USER_ROLE=pi $phpunit $PI ./lib/Controllers/UsageExplorerSupremmTest.php - #REG_TEST_USER_ROLE=cs $phpunit $CS ./lib/Controllers/UsageExplorerSupremmTest.php - #$phpunit $PUB ./lib/Controllers/UsageExplorerSupremmTest.php - - run_warehouse_raw_data_tests -else - REG_TEST_USER_ROLE=cd $phpunit $CD --exclude-group warehouseRawData . & cdpid=$! - - #REG_TEST_USER_ROLE=usr $phpunit $REGUSER ./lib/Controllers/UsageExplorerSupremmTest.php & usrpid=$! - #REG_TEST_USER_ROLE=pi $phpunit $PI ./lib/Controllers/UsageExplorerSupremmTest.php & pipid=$! - #REG_TEST_USER_ROLE=cs $phpunit $CS ./lib/Controllers/UsageExplorerSupremmTest.php & cspid=$! - #$phpunit $PUB ./lib/Controllers/UsageExplorerSupremmTest.php & pubpid=$! - - run_warehouse_raw_data_tests & warehousepid=$! - - EXIT_STATUS=0 - for pid in $usrpid $pipid $cdpid $cspid $pubpid $warehousepid; - do - wait "$pid" - if [ "$?" -ne "0" ]; - then - EXIT_STATUS=1 - fi - done - exit $EXIT_STATUS -fi +source $XDMOD_SRC_DIR/tests/regression/runtests.sh