Exemple #1
0
def test_put_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        local('echo "toto" > /tmp/toto')
        put('/tmp/toto', '/tmp/toto')
        assert run('test -f /tmp/toto').succeeded
Exemple #2
0
def test_sudo_nobody_file_ownership_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        with cd('/tmp'):
            sudo('touch tata', user='******')
            assert run('stat -c "%U" tata') == 'nobody'
Exemple #3
0
def test_install_redis_in_guest_context_manager(container):
    from burlap.openvz import guest
    from burlap.require.redis import VERSION, instance

    with guest(container):
        instance('test')
        assert is_file('/etc/redis/test.conf')
        assert run('echo PING | /opt/redis-%s/redis-cli' % VERSION) == 'PONG'
Exemple #4
0
def test_require_directory_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        require_directory('/tmp/newdir')
        with cd('/tmp/newdir'):
            run('touch baz')
        assert is_file('/tmp/newdir/baz')
Exemple #5
0
def test_cd_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        with cd('/tmp'):
            run('touch bar')
            assert is_file('bar')
        assert is_file('/tmp/bar')
Exemple #6
0
def test_install_debian_package_in_guest_context_manager(container):
    from burlap.deb import update_index
    from burlap.openvz import guest
    from burlap.require.deb import package as require_deb_package

    with guest(container):
        update_index()
        require_deb_package('htop')
        assert is_file('/usr/bin/htop')
Exemple #7
0
def test_require_file_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        require_file('/tmp/foo')
        assert is_file('/tmp/foo')
Exemple #8
0
def test_sudo_nobody_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        assert sudo('whoami', user='******') == 'nobody'
Exemple #9
0
def test_sudo_root_in_guest_context_manager(container):
    from burlap.openvz import guest

    with guest(container):
        assert sudo('whoami') == 'root'