Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Robustness improvements for integration tests #726

Merged
merged 4 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions html/internal_dashboard/controllers/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@
header("Content-type: application/xls");
header("Content-Disposition:attachment;filename=\"xdmod_visitation_stats_by_$timeframe.csv\"");

print implode(',', array_keys($response['stats'][0])) . "\n";
if (isset($response['stats'][0])) {
print implode(',', array_keys($response['stats'][0])) . "\n";
}

$previous_timeframe = '';

Expand Down Expand Up @@ -214,4 +216,4 @@

// =====================================================

print json_encode($response);
print json_encode($response);
15 changes: 8 additions & 7 deletions html/internal_dashboard/controllers/pseudo_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

// ======================================================================

function getAbsoluteURL() {

$protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';

return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];

}//getAbsoluteURL
function getAbsoluteURL()
{
$protocol = 'http://';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
$protocol = 'https://';
}
return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
}

// ======================================================================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,35 +268,11 @@ public function testCreateReport(array $options)
}

// render the charts as volatile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this comment can be removed as well since it is on 276 as wel

// also, ensure the chart values in the report data are up to date.
$count = 1;
foreach ($chartParams as $chartData) {
// first, retrieve the data previously gathered in the chart creation
// & rendering loop above.
$params = $chartData['params'];
$startDate = $chartData['start_date'];
$endDate = $chartData['end_date'];
$chartRef = $params['ref'];

// generate the cacheRef && chartData keys & values.
$chartCacheRefKey = "chart_cache_ref_$count";
$chartCacheRef = "$startDate-$endDate;xd_report_$chartRef";

$chartDataKey = "chart_data_$count";
$chartDataValue = $chartData['chart_id'];

// Update the chart type to volatile
$params['type'] = 'volatile';

// render the volatile chart.
$this->reportImageRenderer($params);

// Ensure that the chart_ref & chart_data values for this entry
// are up to date.
$data[$chartCacheRefKey] = $chartCacheRef;
$data[$chartDataKey] = $chartDataValue;

$count++;
}

// Retrieve the next available report name for this user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ public function authenticateSSO($parameters, $includeDefault = true)
list($action, $credentials) = $this->getHTMLFormData($result[0]);

$result = $this->post($action, null, $credentials, true);

if ($result[1]['http_code'] !== 200) {
throw new \Exception('SSO signin failure: HTTP code' . $result[1]['http_code']);
}
if (strpos($result[0], 'Logging you into XDMoD') === false) {
throw new \Exception('SSO signin failure: ' . $result[0]);
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ build:
- ./open_xdmod/modules/xdmod/automated_tests/runtests.sh --headless --log-junit `pwd`/shippable/testresults --sso
- ./vendor/phpunit/phpunit/phpunit -c ./open_xdmod/modules/xdmod/integration_tests/phpunit.xml.dist --testsuite sso --log-junit `pwd`/shippable/testresults/xdmod-sso-integration.xml
- mv ./configuration/portal_settings.ini.old ./configuration/portal_settings.ini
- if [ -s /var/log/xdmod/apache-error.log ]; then cat /var/log/xdmod/apache-error.log; false; fi
on_failure:
- cat /var/log/xdmod/*