Manual testing with oardocker

Set user:


or to get access to privileged commands


Then set the URL API:

  • from outside oardocker containers
  • from inside the oardocker frontend container

Example of GET request:

curl -i -X GET $OARAPI/jobs/1/details.json


curl -i -X GET $OARAPI/jobs/1/details -H'Content-Type: application/json'

Example of POST request:

curl -i -X POST $OARAPI/jobs/1.json -d '{"method":"delete"}'


curl -i -X POST $OARAPI/jobs/1 -H'Content-Type: application/json' -d '{"method":"delete"}'

Rspec tests in oardocker

Supposing you installed oar-docker, launching the API tests is as simple as:

cd ~/src/oar
oardocker init -e jessie
oardocker build install . start -v $PWD:/home/docker/oar
oardocker connect frontend
cd oar/tests/rspec
# workaround for bad apache init
systemctl restart oardocker-apache.service
make APIURI=http://docker:docker@localhost:6668/oarapi-priv/

WARNING: for the Rspec tests to success, OAR must have at least 4 * 2 cores.

Rspec tests in oar-vagrant

Follow the instructions from the oar-vagrant page. Set up a 2 nodes cluster with:



To get root access on the VMs, you'll have to connect with the vagrant user:

vagrant ssh frontend -- -l vagrant
vagrant@frontend: /home/vagrant $ sudo su -
root@frontend: /root # 

Debian dependencies

If you run a Debian appliance:

  • Install dependencies on the “frontend” host:
root@frontend:~# apt-get install ruby-rspec ruby-rest-client
  • If you want to run the oaradmin tests, you need to install oaradmin:
root@frontend:~# apt-get install libdbd-pg-ruby oar-admin

Centos dependencies

If you run a Centos appliance:

* Install RPM dependencies

yum install rubygems

* Install a recent ruby version, using RVM

curl -L | bash -s stable
source /etc/profile.d/
rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default

* Install required gems

gem install rspec rest_client json

Running the tests

  • Copy the test files from the OAR git repository into the current Vagrant directory:
# From your local host, inside the vagrant directory, supposing you have OAR sources into ~/git/oar:
[bzizou@bart|oar-vagrant]$ cp -a ~/git/oar/tests/rspec .
  • Log on as root on the frontend, ans prepare some more resources (faking more cores)
# Copy/paste this in a root session on the frontend
oarnodesetting -s Dead -h node-2
ssh server oarremoveresource 2
oarnodesetting -a -h node-1 -p cpu=0 -p core=1 -p cpuset=0
oarnodesetting -a -h node-1 -p cpu=1 -p core=2 -p cpuset=0
oarnodesetting -a -h node-1 -p cpu=1 -p core=3 -p cpuset=0
oarnodesetting -a -h node-2 -p cpu=2 -p core=4 -p cpuset=0
oarnodesetting -a -h node-2 -p cpu=2 -p core=5 -p cpuset=0
oarnodesetting -a -h node-2 -p cpu=3 -p core=6 -p cpuset=0
oarnodesetting -a -h node-2 -p cpu=3 -p core=7 -p cpuset=0
  • If you installed Ruby with RVM (centos appliance), source rvm profile, as user1:
[user1@frontend|rspec]$ source /etc/profile.d/
  • Launch the tests from the frontend, as user1:
[user1@frontend|rspec]$ cd /vagrant/rspec
[user1@frontend|rspec]$ make APIURI=http://localhost:6668/oarapi/

Warning! Don't forget the trailing slash at “/localhost/oarapi/”!

  • Launch the tests for resources creation, as oar (admin) - This needs oar-admin (not available as packages for Centos):
[user1@frontend|rspec]$ su -
root@frontend:~# su - oar
[oar@frontend|rspec]$ cd /vagrant/rspec
[oar@frontend|rspec]$ make resources_creation APIURI=http://localhost/oarapi/

Warning! Don't forget the trailing slash at “/localhost/oarapi/”!

wiki/running_the_api_tests.txt · Last modified: 2017/06/30 16:49 by neyron
Recent changes RSS feed GNU Free Documentation License 1.3 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki