Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update CI image to latest version. Add new tests #169

Merged
merged 1 commit into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected function setUp()
*/
public function testGetDwDescripter()
{
$this->helper->authenticate('po');
$this->helper->authenticate('cd');

$response = $this->helper->post('/controllers/metric_explorer.php', null, array('operation' => 'get_dw_descripter'));

Expand Down Expand Up @@ -51,4 +51,57 @@ public function testGetDwDescripterNoAuth()
$this->assertEquals($response[1]['content_type'], 'application/json');
$this->assertEquals($response[1]['http_code'], 401);
}

/**
* Checks that the filters work correctly
*/
public function testGetDimensionFilters()
{
$this->helper->authenticate('usr');

$params = array(
'operation' => 'get_dimension',
'dimension_id' => 'username',
'realm' => 'Jobs',
'public_user' => false,
'start' => '',
'limit' => '10',
'selectedFilterIds' => ''
);

$response = $this->helper->post('/controllers/metric_explorer.php', null, $params);

$this->assertEquals($response[1]['content_type'], 'application/json');
$this->assertEquals($response[1]['http_code'], 200);
$this->assertEquals($response[0]['totalCount'], 1);

$this->helper->logout();

$this->helper->authenticate('cd');

$response = $this->helper->post('/controllers/metric_explorer.php', null, $params);

$this->assertEquals($response[1]['content_type'], 'application/json');
$this->assertEquals($response[1]['http_code'], 200);
$this->assertGreaterThan(1, $response[0]['totalCount']);
$totalUsers = $response[0]['totalCount'];

$this->helper->logout();

$this->helper->authenticate('pi');

$response = $this->helper->post('/controllers/metric_explorer.php', null, $params);

$this->assertEquals($response[1]['content_type'], 'application/json');
$this->assertEquals($response[1]['http_code'], 200);
$this->assertGreaterThan(1, $response[0]['totalCount']);
$this->assertLessThan($totalUsers, $response[0]['totalCount']);

$this->helper->logout();

$response = $this->helper->post('/controllers/metric_explorer.php', null, $params);

$this->assertEquals($response[1]['content_type'], 'application/json');
$this->assertEquals($response[1]['http_code'], 401);
}
}
18 changes: 9 additions & 9 deletions open_xdmod/modules/xdmod/integration_tests/runtests.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh

set -e

if [ ! -e .secrets ];
then
echo "ERROR missing .secrets file." >&2
echo >&2
cat README.md >&2
false
PHPUNITARGS="$@"

cd $(dirname $0)
phpunit="$(readlink -f ../../../../vendor/bin/phpunit)"

if [ ! -x "$phpunit" ]; then
echo phpunit not found, run \"composer install\" 1>&2
exit 127
fi

phpunit `dirname $0`
$phpunit ${PHPUNITARGS} .
8 changes: 4 additions & 4 deletions open_xdmod/modules/xdmod/integration_tests/secrets_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"url": "SET THIS TO THE URL OF THE XDMOD INSTANCE TO TEST",
"role": {
"po": {
"cd": {
"username": "FILL_ME_IN",
"password": "FILL_ME_IN"
},
"cd": {
"cs": {
"username": "FILL_ME_IN",
"password": "FILL_ME_IN"
},
"usr": {
"pi": {
"username": "FILL_ME_IN",
"password": "FILL_ME_IN"
},
"...": {
"usr": {
"username": "FILL_ME_IN",
"password": "FILL_ME_IN"
}
Expand Down
7 changes: 5 additions & 2 deletions shippable.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
language: none
build:
cache: true
cache_dir_list:
- /root/.composer
pre_ci_boot:
image_name: tas-tools-ext-01.ccr.xdmod.org/centos7-xdmod6.6.0
image_tag: version1
image_tag: version3
pull: true
options: "--user root -e HOME=/root"
ci:
Expand All @@ -12,4 +15,4 @@ build:
- ~/bin/services start
- cp ~/assets/secrets open_xdmod/modules/xdmod/integration_tests/.secrets
- composer --dev install
- cd open_xdmod/modules/xdmod/integration_tests && /usr/bin/env PATH=$SHIPPABLE_BUILD_DIR/vendor/bin:$PATH ./runtests.sh
- ./open_xdmod/modules/xdmod/integration_tests/runtests.sh --log-junit `pwd`/shippable/testresults/results.xml