(→prerequisites) |
(→prerequisites) |
||
| Line 9: | Line 9: | ||
* An smtp server is needed for OTS to be able to send result emails. | * An smtp server is needed for OTS to be able to send result emails. | ||
** You can use the smtp server provided by your ISP or organization | ** You can use the smtp server provided by your ISP or organization | ||
| - | ** Or you can setup your own. for example [http://my.opera.com/Contrid/blog/show.dml/ | + | ** Or you can setup your own. for example [http://my.opera.com/Contrid/blog/show.dml/478684 postfix] |
==== Basic Setup ==== | ==== Basic Setup ==== | ||
Contents |
These instructions have been tested with Ubuntu 10.04.
sudo apt-get update sudo apt-get install python-setuptools python-amqplib python-django
sudo easy_install minixsv
cd ots/ots.common/ sudo python setup.py install
cd ots/ots.server/ sudo python setup.py install
sudo mkdir /var/log/ots
In [1]: from ots.server.xmlrpc.public import request_sync In [4]: program = "example_sw_product" In [5]: request = "5" In [6]: notify_list = ['tvainio@localhost'] In [7]: options = dict() In [8]: options['image'] = "http://somewhere/some_image.bin" In [9]: options['email'] = "off" In [13]: options["device"] = "devicegroup:default" # Make this match the worker In [14]: request_sync(program, request, notify_list, options) Out[14]: 'FAIL'
The result will be PASS/FAIL/ERROR. ERROR means that something went wrong in server side and testrun was not even started. FAIL means failed testrun and PASS means that everything went fine and all tests passed. Testrun logs with more information about the possible errors are available in /var/log/ots/
The previous example was not very useful. To get OTS server running as a real server you have two options. A simple xmlrpc server or a more advanced django based server. First thing you need to do is setup a custom config file.
Ots server tries to import a configuration module ots_extensions.ots_config. If it does not succeed it uses the default from ots.server.testrun_host.default_ots_config. You can set up your own ots_config by following these instructions:
mkdir my_ots_extensions
export PYTHONPATH=/full/path/to/my_ots_extensions/:$PYTHONPATH
mkdir my_ots_extensions/ots_extensions touch my_ots_extensions/ots_extensions/__init__.py
You can define default values for all options here. The example_sw_product contains and example how to define options. You cannot use an sw_product if it does not contain the default options in ots_config. Here's a small example. I'm developing a Meego based coffeemaker and creating custom software images for it. To automate the testing I create an sw_product called "my_meego_variant": TODO: Document all options
#
# Defaults for my_meego_variant
#
# Lets start with the global_defaults
default_options["my_meego_variant"] = global_defaults.copy()
# The images work only on meego coffeemakers so the default devicegroup will be "meego_coffeemaker"
default_options["my_meego_variant"]['device'] = {'devicegroup':'meego_coffeemaker'}
# Coffeemaker needs to be fast so we define a 3 minutes global timeout for the test execution.
default_options["my_meego_variant"]['timeout'] = 3
OTS uses plugins to do various things during the testrun. You can write your own plugins to add more functionality by implementing a module ots_extensions.extension_points. An example file can be found from ots/ots.server/ots/server/testrun_host/example_extension_points.py
ots_server
cd ots/ots.tools/ sudo python setup.py install
ots_trigger -s your_xmlrpc_host:your_xmlrpc_port -b 333 -i url_to_dummyimage -p my_meego_variant -e your_email_address
The result should be FAIL and if your email server settings are correct you should also receive an email.
2010-09-24 15:48:21,188 conductorengine ERROR Device group 'meego_coffeemaker' does not exist
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/ots.server-0.1dev-py2.6.egg/ots/server/conductorengine/conductorengine.py", line 150, in execute
self._taskrunner.run()
File "/usr/local/lib/python2.6/dist-packages/ots.server-0.1dev-py2.6.egg/ots/server/distributor/taskrunner.py", line 417, in run
(self._routing_key))
OtsQueueDoesNotExistError: No queue for meego_coffeemaker
With Django and Apache it's possible to set up a more advanced ots server.
There's for example a global logger application available in ots.server.logger. By setting up the logger it is possible to get log messages for a specific testrun from all parts of the system (ots server, ots conductor and testrunner-lite). The logs are stored into DB and can be accessed with a web UI. It's also easy to implement a result db and web views for the test results.
TODO: Add instructions
sudo apt-get update sudo apt-get install python-setuptools python-amqplib
cd ots/ots.common/ sudo python setup.py install
cd ots/ots.worker/ sudo python setup.py install
[Worker] ########################################### # REPLACE `fix_me` WITH YOUR DEVICEGROUP ########################################### queue = meego_coffeemaker # routing_key = meego_coffeemaker # Change these 3 lines to the devicegroup this worker belongs to services_exchange = meego_coffeemaker # ############################### # ADVANCED CONFIGURATION ############################### host = your_server_address # Change this to your ots server address vhost = / port = 5672 username = guest password = guest consumer_tag = worker log_file = /var/log/ots.log
sudo ots_worker
010-09-24 11:00:41,373 - amqplib - DEBUG - Open OK! known_hosts [starshollow:5672]
2010-09-24 11:00:41,374 - amqplib - DEBUG - using channel_id: 1
2010-09-24 11:00:41,374 - amqplib - DEBUG - Channel open
2010-09-24 11:00:41,375 - ots.worker.worker - DEBUG - Starting the server. {vhost:'/', queue:'meego_coffeemaker', routing_key:'meego_coffeemaker'}
2010-09-24 11:00:41,377 - ots.worker.task_broker - DEBUG - Starting main loop...