Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Merge branch 'bareos-17.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed Jan 29, 2018
2 parents 7d9c627 + dbd18be commit a4d2536
Show file tree
Hide file tree
Showing 4 changed files with 259 additions and 128 deletions.
7 changes: 7 additions & 0 deletions module/Application/config/module.config.php
Expand Up @@ -123,10 +123,12 @@
'default' => array(
array(
'label' => _('Dashboard'),
'id' => 'topnavbar-dashboard',
'route' => 'dashboard',
),
array(
'label' => _('Jobs'),
'id' => 'topnavbar-job',
'route' => 'job',
'pages' => array(
array(
Expand All @@ -143,18 +145,22 @@
),
array(
'label' => _('Restore'),
'id' => 'topnavbar-restore',
'route' => 'restore',
),
array(
'label' => _('Clients'),
'id' => 'topnavbar-client',
'route' => 'client',
),
array(
'label' => _('Schedules'),
'id' => 'topnavbar-schedule',
'route' => 'schedule',
),
array(
'label' => _('Storages'),
'id' => 'topnavbar-storage',
'route' => 'storage',
'pages' => array(
array(
Expand All @@ -181,6 +187,7 @@
),
array(
'label' => _('Director'),
'id' => 'topnavbar-director',
'route' => 'director',
),
),
Expand Down
6 changes: 1 addition & 5 deletions module/Restore/src/Restore/Model/RestoreModel.php
Expand Up @@ -56,11 +56,7 @@ public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
$result = $bsock->send_command($cmd_1, 2, $jobid);
$directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);

if ( empty($directories['result']) ) {
return $retval;
}

if(empty($directories['result']['directories'])) {
if(empty($directories['result'])) {
$cmd_2 = '.bvfs_lsdirs jobid='.$jobid.' path=@ limit='.$limit;
$result = $bsock->send_command($cmd_2, 2, $jobid);
$directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
Expand Down
33 changes: 23 additions & 10 deletions tests/selenium/README.md
Expand Up @@ -2,23 +2,36 @@

This test checks the Bareos WebUI by using seleniums webdriver.

## Requirements

* Python >= 2.7
* Selenium >= 3.4.0
* chromedriver or geckodriver

## Setting up the test

To run the test you must set certain environment variables:

* **BROWSER**: The test takes either 'firefox' or 'chrome', where 'firefox' is the default.
* **USERNAME** and **PASSWORD**: These should contain the login information for the WebUI.
* **VM_IP**: This should be the IP adress of the system where the Bareos WebUI runs on.
* **RESTOREFILE**: The third test is designed to restore a certain file. The default path is '/usr/sbin/bconsole".
* **CLIENT**: Here you need to set what Client the restore test should select.
* `BAREOS_BROWSER`: The test takes either 'firefox' or 'chrome', default: `firefox`
* `BAREOS_BASE_URL`: The base url of the bareos-webui, default: `http://127.0.0.1/bareos-webui/`.
* `BAREOS_USERNAME`: Login user name, default: `admin`
* `BAREOS_PASSWORD`: Login password, default: `secret`
* `BAREOS_CLIENT_NAME`: The client to use. Default is `bareos-fd`
* `BAREOS_RESTOREFILE`: The third test is designed to restore a certain file. The default path is `/usr/sbin/bconsole`
* `BAREOS_LOG_PATH`: Directory to create selenium log files. The default path is the current directory.
* `BAREOS_DELAY`: Delay between action is seconds. Useful for debugging. Default is `0.0`

## Running the test

To run all tests included you need a system that runs the WebUI, a client for restore-testing, chromedriver or geckodriver as well as any Python >= 2.7.
`
BAREOS_BASE_URL=http://127.0.0.1/bareos-webui/
BAREOS_USERNAME=admin
BAREOS_PASSWORD=linuxlinux
BAREOS_CLIENT=bareos-fd
BAREOS_RESTOREFILE=/etc/passwd
BAREOS_LOG_PATH=/tmp/selenium-logs/
BAREOS_DELAY=1
python webui-selenium-test.py -v
`

If you meet all the requirements and set the environment variables you can run the test with `python webui-selenium-test.py`.

## Debugging

If the test should fail you will find additional informations in the webui-selenium-test.log file. You might want to adjust **SLEEPTIME** environment variable to be set above 1 as it increases the time waited between commands.

0 comments on commit a4d2536

Please sign in to comment.