Skip to content

Commit 4a8779f

Browse files
committed
Simplify regression test code.
1 parent 53f3d86 commit 4a8779f

File tree

3 files changed

+10
-149
lines changed

3 files changed

+10
-149
lines changed

tests/regression/lib/Controllers/MetricExplorerSupremmChartsTest.php

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,18 @@
22

33
namespace RegressionTests\Controllers;
44

5-
use IntegrationTests\TestHarness\Utilities;
6-
use IntegrationTests\TestHarness\XdmodTestHelper;
75
use RegressionTests\Controllers\MetricExplorerChartsTest;
86

97
class MetricExplorerSupremmChartsTest extends MetricExplorerChartsTest
108
{
11-
public function filterTestsProvider()
9+
protected static function getFilterTestBaseConfig()
1210
{
13-
$data_file = realpath(__DIR__ . '/../../../artifacts/regression/chartFilterTests.json');
14-
if (file_exists($data_file)) {
15-
$inputs = json_decode(file_get_contents($data_file), true);
16-
} else {
17-
// Generate test permutations. The expected values for the data points are not set.
18-
// this causes the test function to record the values and they are then written
19-
// to a file in the tearDownAfterClass function.
20-
$baseConfig = array(
21-
array('realm' => 'SUPREMM', 'metric' => 'wall_time', 'date' => '2016-12-29')
22-
);
23-
24-
$inputs = $this->generateFilterTests($baseConfig);
25-
}
26-
27-
$helper = new XdmodTestHelper();
28-
$helper->authenticate('cd');
29-
30-
$enabledRealms = Utilities::getRealmsToTest();
31-
32-
$output = array();
33-
foreach ($inputs as $test)
34-
{
35-
if (in_array(strtolower($test['settings']['realm']), $enabledRealms)) {
36-
$output[] = array($helper, $test['settings'], $test['expected']);
37-
}
38-
}
39-
40-
return $output;
11+
return [
12+
[
13+
'realm' => 'SUPREMM',
14+
'metric' => 'wall_time',
15+
'date' => '2016-12-29'
16+
]
17+
];
4118
}
4219
}

tests/regression/lib/Controllers/UsageExplorerSupremmTest.php

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,8 @@
88
/**
99
* Test the usage explorer for jobs realm regressions.
1010
*/
11-
class UsageExplorerJobsTest extends TestCase
11+
class UsageExplorerJobsTest extends aUsageExplorerTest
1212
{
13-
/**
14-
* @var RegressionTestHelper
15-
*/
16-
private static $helper;
17-
18-
/**
19-
* Create the helper and authenticate.
20-
*/
21-
public static function setUpBeforeClass(): void
22-
{
23-
self::$helper = new RegressionTestHelper();
24-
self::$helper->authenticate();
25-
}
26-
27-
/**
28-
* Log out and output any messages generated by tests.
29-
*/
30-
public static function tearDownAfterClass(): void
31-
{
32-
self::$helper->logout();
33-
self::$helper->outputMessages();
34-
}
35-
36-
/**
37-
* Test usage explorer CSV export.
38-
*
39-
* @group regression
40-
* @group UsageExplorer
41-
* @dataProvider csvExportProvider
42-
*/
43-
public function testCsvExport($testName, $input, $expectedFile, $userRole)
44-
{
45-
$this->assertTrue(self::$helper->checkCsvExport($testName, $input, $expectedFile, $userRole));
46-
}
47-
4813
public function csvExportProvider()
4914
{
5015
$statistics = [

tests/regression/runtests.sh

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1 @@
1-
#!/bin/bash
2-
3-
set -e
4-
5-
REGUSER=""
6-
PI=""
7-
CD=""
8-
CS=""
9-
PUB=""
10-
WAREHOUSE=""
11-
12-
if [ "$1" = "--junit-output-dir" ];
13-
then
14-
REGUSER="--log-junit $2/xdmod-supremm-regression-user.xml"
15-
PI="--log-junit $2/xdmod-supremm-regression-principalinvestigator.xml"
16-
CD="--log-junit $2/xdmod-supremm-regression-centerdirector.xml"
17-
CS="--log-junit $2/xdmod-supremm-regression-centerstaff.xml"
18-
PUB="--log-junit $2/xdmod-supremm-regression-public.xml"
19-
WAREHOUSE="--log-junit $2/xdmod-supremm-regression-warehouse.xml"
20-
fi
21-
22-
cd $(dirname $0)
23-
24-
if [ ! -e ../../../xdmod/tests/ci/testing.json ];
25-
then
26-
echo "ERROR missing .secrets.json file." >&2
27-
echo >&2
28-
cat README.md >&2
29-
exit 126
30-
fi
31-
32-
phpunit="$(readlink -f ../../../xdmod/vendor/bin/phpunit)"
33-
34-
if [ ! -x "$phpunit" ]; then
35-
echo phpunit not found, run \"composer install\" 1>&2
36-
exit 127
37-
fi
38-
39-
export REG_TEST_BASE=${REG_TEST_BASE:-/../../../../../xdmod-supremm/tests/artifacts/regression/current/}
40-
41-
function run_warehouse_raw_data_tests {
42-
# Need to ignore the values of deidentified usernames when comparing the
43-
# actual and expected data because the values will be different depending
44-
# on whether XDMOD_TEST_MODE is set to 'upgrade' or 'fresh_install' since
45-
# these two testing pipelines produce different hashes for the usernames.
46-
REG_TEST_USER_ROLE=usr \
47-
REG_TEST_REGEX='/[0-9a-f]{40}/' \
48-
REG_TEST_REPLACE='<username>' \
49-
$phpunit $WAREHOUSE --group warehouseRawData .
50-
}
51-
52-
if [ "$REG_TEST_ALL" == "1" ]; then
53-
set +e
54-
REG_TEST_USER_ROLE=cd $phpunit $CD --exclude-group warehouseRawData .
55-
56-
#REG_TEST_USER_ROLE=usr $phpunit $REGUSER ./lib/Controllers/UsageExplorerSupremmTest.php
57-
#REG_TEST_USER_ROLE=pi $phpunit $PI ./lib/Controllers/UsageExplorerSupremmTest.php
58-
#REG_TEST_USER_ROLE=cs $phpunit $CS ./lib/Controllers/UsageExplorerSupremmTest.php
59-
#$phpunit $PUB ./lib/Controllers/UsageExplorerSupremmTest.php
60-
61-
run_warehouse_raw_data_tests
62-
else
63-
REG_TEST_USER_ROLE=cd $phpunit $CD --exclude-group warehouseRawData . & cdpid=$!
64-
65-
#REG_TEST_USER_ROLE=usr $phpunit $REGUSER ./lib/Controllers/UsageExplorerSupremmTest.php & usrpid=$!
66-
#REG_TEST_USER_ROLE=pi $phpunit $PI ./lib/Controllers/UsageExplorerSupremmTest.php & pipid=$!
67-
#REG_TEST_USER_ROLE=cs $phpunit $CS ./lib/Controllers/UsageExplorerSupremmTest.php & cspid=$!
68-
#$phpunit $PUB ./lib/Controllers/UsageExplorerSupremmTest.php & pubpid=$!
69-
70-
run_warehouse_raw_data_tests & warehousepid=$!
71-
72-
EXIT_STATUS=0
73-
for pid in $usrpid $pipid $cdpid $cspid $pubpid $warehousepid;
74-
do
75-
wait "$pid"
76-
if [ "$?" -ne "0" ];
77-
then
78-
EXIT_STATUS=1
79-
fi
80-
done
81-
exit $EXIT_STATUS
82-
fi
1+
source $XDMOD_SRC_DIR/tests/regression/runtests.sh

0 commit comments

Comments
 (0)