fabtest-0.1.5
توضیحات
Test Fabric scripts on VirtualBox VMs
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fabtest-0.1.5 |
| نام | fabtest |
| نسخه کتابخانه | 0.1.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Mikhail Korobov |
| ایمیل نویسنده | kmike84@gmail.com |
| آدرس صفحه اصلی | https://bitbucket.org/kmike/fabtest/ |
| آدرس اینترنتی | https://pypi.org/project/fabtest/ |
| مجوز | MIT license |
=======
Fabtest
=======
Fabtest is a set of utilities and base TestCases that aid testing Fabric
scripts against VirtualBox VMs. License is MIT.
VM is rolled back to initial state before each test so tests can do anything
with target system; Fabric commands can be run from Python.
Installation
------------
::
pip install fabtest
VMs
---
In order to run tests you'll need `VirtualBox`_ 4.x and an OS image.
Image should have ssh server installed.
Example VMs (they can be imported to VirtualBox via File->Import Appliance):
* `Lenny.ova (312M) <http://dl.dropbox.com/u/21197464/Lenny.ova>`_
* `Squeeze.ova (436M) <http://dl.dropbox.com/u/21197464/Squeeze.ova>`_
* `Ubuntu-10.10.ova (277M) <http://dl.dropbox.com/u/21197464/Ubuntu-10.10.ova>`_
* `Ubuntu-10.04.ova (375M) <http://dl.dropbox.com/u/21197464/Ubuntu-10.04.ova>`_
Due to bugs in VirtualBox it is better to convert imported .vmdk disk images
to .vdi images, e.g.::
VBoxManage clonehd Ubuntu-10.10-disk1.vmdk Ubuntu-10.10-disk.vdi --format VDI
Then detach (and remove) vmdk disk from the VM and attach the vdi image.
After you get the image, make sure it is not running and execute the
``fabtest-preparevm`` script (pass your VM name or uid to it)::
fabtest-preparevm Lenny
This command configures port forwarding (127.0.0.1:2222 to guest 22 port,
127.0.0.1:8888 to guest 80 port) and takes 'fabtest-initial' snapshot
used for test rollbacks (it is taken from booted machine in order to
speedup tests).
.. _VirtualBox: http://www.virtualbox.org/
Writing tests
-------------
Subclass fabtest.VirtualBoxTest or fabtest.FabTest and use fabtest.fab for
fabric commands execution::
from fabric.api import run
from fabtest import FabTest, fab
def whoami():
return run('whoami')
class MyTestCase(FabTest):
def test_root_login(self):
output = fab(whoami)
self.assertEqual(output, 'root')
Look at source code (and example/runtests.py) for more.
CHANGES
=======
0.1.5 (2012-04-19)
------------------
* Improved workaround for a VirtualBox bug.
0.1.4 (2012-04-19)
------------------
* Workaround for a VirtualBox bug under Windows.
0.1.3 (2012-04-14)
------------------
* Packaging fixes.
0.1.1 (2012-03-02)
------------------
* Better exception handling (the original traceback is preserved).
0.1 (2012-03-01)
----------------
* Fabric >= 1.4 is supported (and required);
* more reliable virtualbox snapshot handling;
* ``fab`` function now wraps fabric's ``execute`` and
returns single value, not a list of values.
0.0.8 (2011-03-22)
------------------
* Many tweaks & bug fixes.
0.0.1 (2011-02-16)
------------------
Initial experimental release (extracted from django-fab-deploy).
نحوه نصب
نصب پکیج whl fabtest-0.1.5:
pip install fabtest-0.1.5.whl
نصب پکیج tar.gz fabtest-0.1.5:
pip install fabtest-0.1.5.tar.gz