Skip to main content

Test Fabric scripts on VirtualBox VMs

Project description

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:

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).

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

class MyTestCase(FabTest):

    def test_root_login(self):
        def fabric_command():
            output = run('whoami')
            self.assertEqual(output, 'root')
        fab(fabric_command)

Look at source code (and example/runtests.py) for more.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabtest-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file fabtest-0.0.1.tar.gz.

File metadata

  • Download URL: fabtest-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fabtest-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c4d918a674fac35af9016f8726c6c185f569f63c04c6a374c0cf3abe3e8d94b1
MD5 a1a5ba2132e47ac42711aa6bc6ac4953
BLAKE2b-256 020e473adc04a693a43b0e34456a233d944f86c885a39cc04c8b299ba3cb70ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page