Пример #1
0
    def test_installation(self):
        gr_node = self.result['gr_nodes'][0]
        (_, _, gr_dockername) = gr_node.partition('@')

        command = 'apt-get update && ' \
                  'apt-get install -y python && ' \
                  'python /root/data/deb_install_script.py'

        container = docker.run(tty=True,
                               interactive=True,
                               detach=True,
                               image='ubuntu:vivid',
                               hostname='devel.localhost.local',
                               workdir="/root",
                               run_params=['--privileged=true'],
                               link={gr_dockername: 'onedata.org'},
                               volumes=[(package_dir, '/root/pkg', 'ro'),
                                        (scripts_dir, '/root/data', 'ro')],
                               reflect=[('/sys/fs/cgroup', 'rw')])

        try:
            assert 0 == docker.exec_(container,
                                     command=command,
                                     interactive=True,
                                     tty=True)
        finally:
            docker.remove([container], force=True, volumes=True)
Пример #2
0
 def fin():
     docker.exec_(container, [
         'btrfs', 'subvolume', 'delete', '/var/lib/ceph/osd/ceph-0/current'
     ])
     docker.exec_(container, [
         'btrfs', 'subvolume', 'delete', '/var/lib/ceph/osd/ceph-0/snap_1'
     ])
     docker.remove([container], force=True, volumes=True)
Пример #3
0
    def __init__(self, request, link={}, privileged=False):
        package_dir = os.path.join(os.getcwd(), 'package/{0}/x86_64'.
                                   format(request.param))
        config_dir = os.path.join(file_dir, 'rpm_install_test_data')

        self.name = request.param
        self.release = '1802'
        self.image = {
            'centos-7-x86_64': 'centos:7'
        }[self.name]
        self.repo = {
            'centos-7-x86_64': 'centos_7x'
        }[self.name]
        self.container = docker.run(interactive=True,
                                    tty=True,
                                    detach=True,
                                    image=self.image,
                                    hostname='onedata.test.local',
                                    privileged=True,
                                    link=link,
                                    stdin=sys.stdin,
                                    stdout=sys.stdout,
                                    stderr=sys.stderr,
                                    volumes=[
                                        (package_dir, '/root/pkg', 'ro'),
                                        (config_dir, '/root/data', 'ro')
                                    ],
                                    reflect=[('/sys/fs/cgroup', 'rw')])

        request.addfinalizer(lambda: docker.remove(
            [self.container], force=True, volumes=True))
Пример #4
0
    def __init__(self, request, link={}, privileged=False):
        package_dir = os.path.join(os.getcwd(), 'package/{0}/binary-amd64'.
                                   format(request.param))
        config_dir = os.path.join(file_dir, 'deb_install_test_data')

        self.name = request.param
        self.release = '1802'
        self.image = 'ubuntu:{0}'.format(self.name)
        self.container = docker.run(interactive=True,
                                    tty=True,
                                    detach=True,
                                    image=self.image,
                                    hostname='onedata.test.local',
                                    privileged=privileged,
                                    link=link,
                                    stdin=sys.stdin,
                                    stdout=sys.stdout,
                                    stderr=sys.stderr,
                                    volumes=[
                                        (package_dir, '/root/pkg', 'ro'),
                                        (config_dir, '/root/data', 'ro')
                                    ])

        request.addfinalizer(lambda: docker.remove(
            [self.container], force=True, volumes=True))
Пример #5
0
    def __init__(self, request, link={}, privileged=False):
        package_dir = os.path.join(os.getcwd(), 'package/{0}/x86_64'.
                                   format(request.param))
        config_dir = os.path.join(file_dir, 'rpm_install_test_data')

        self.name = request.param
        self.image = {
            'centos-7-x86_64': 'centos:7',
            'fedora-23-x86_64': 'onedata/fedora-systemd:23'
        }[self.name]
        self.repo = {
            'centos-7-x86_64': 'centos_7x',
            'fedora-23-x86_64': 'fedora_23'
        }[self.name]
        self.container = docker.run(interactive=True,
                                    tty=True,
                                    detach=True,
                                    image=self.image,
                                    hostname='onedata.dev.local',
                                    privileged=True,
                                    link=link,
                                    stdin=sys.stdin,
                                    stdout=sys.stdout,
                                    stderr=sys.stderr,
                                    volumes=[
                                        (package_dir, '/root/pkg', 'ro'),
                                        (config_dir, '/root/data', 'ro')
                                    ],
                                    reflect=[('/sys/fs/cgroup', 'rw')])

        request.addfinalizer(lambda: docker.remove(
            [self.container], force=True, volumes=True))
Пример #6
0
def onezone(request):
    class Onezone(object):
        def __init__(self, nodes):
            (_, _, domain) = nodes[0].partition('@')
            self.domain = domain

    result = env.up(tests.utils.path_utils.config_file('env.json'))

    request.addfinalizer(
        lambda: docker.remove(result['docker_ids'], force=True, volumes=True))

    return Onezone(result['oz_worker_nodes'])
Пример #7
0
def onezone(request):
    class Onezone(object):

        def __init__(self, nodes):
            (_, _, domain) = nodes[0].partition('@')
            self.domain = domain

    result = env.up(tests.utils.path_utils.config_file('env.json'))

    request.addfinalizer(lambda: docker.remove(
        result['docker_ids'], force=True, volumes=True))

    return Onezone(result['oz_worker_nodes'])
Пример #8
0
    def __init__(self, request):
        package_dir = os.path.join(os.getcwd(), 'package/{0}/binary-amd64'.
                                   format(request.param))
        config_dir = os.path.join(file_dir, 'deb_install_test_data')

        self.name = request.param
        self.image = 'ubuntu:{0}'.format(self.name)
        self.container = docker.run(interactive=True,
                                    tty=True,
                                    detach=True,
                                    image=self.image,
                                    hostname='onezone.dev.local',
                                    stdin=sys.stdin,
                                    stdout=sys.stdout,
                                    stderr=sys.stderr,
                                    volumes=[
                                        (package_dir, '/root/pkg', 'ro'),
                                        (config_dir, '/root/data', 'ro')
                                    ])

        request.addfinalizer(lambda: docker.remove(
            [self.container], force=True, volumes=True))
Пример #9
0
#!/usr/bin/env python

"""Cleans up Docker containers given by their name or id. Running containers are
killed first. Volumes are not removed automatically.

Run the script with -h flag to learn about script's running options.
"""

import argparse

from environment import docker


parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Clean up dockers.')

parser.add_argument(
    'docker_ids',
    action='store',
    nargs='*',
    help='IDs of dockers to be cleaned up')

args = parser.parse_args()

docker.remove(args.docker_ids, force=True)
Пример #10
0
 def fin():
     docker.remove([container], force=True, volumes=True)
Пример #11
0
#!/usr/bin/env python

"""Author: Konrad Zemek
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'

Cleans up Docker containers given by their name or id. Running containers are
killed first. Volumes are not removed automatically.

Run the script with -h flag to learn about script's running options.
"""

import argparse

from environment import docker


parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Clean up dockers.')

parser.add_argument(
    'docker_ids',
    action='store',
    nargs='*',
    help='IDs of dockers to be cleaned up')

args = parser.parse_args()

docker.remove(args.docker_ids, volumes=True, force=True)
 def teardown_class(cls):
     docker.remove(cls.result['docker_ids'], force=True, volumes=True)
Пример #13
0
 def fin():
     docker.remove([container], force=True, volumes=True)
Пример #14
0
#!/usr/bin/env python
"""Author: Konrad Zemek
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'

Cleans up Docker containers given by their name or id. Running containers are
killed first. Volumes are not removed automatically.

Run the script with -h flag to learn about script's running options.
"""

import argparse

from environment import docker

parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Clean up dockers.')

parser.add_argument('docker_ids',
                    action='store',
                    nargs='*',
                    help='IDs of dockers to be cleaned up')

args = parser.parse_args()

docker.remove(args.docker_ids, volumes=True, force=True)
Пример #15
0
 def fin():
     docker.remove(request.onedata_environment['docker_ids'],
                   force=True,
                   volumes=True)
Пример #16
0
 def fin():
     docker.exec_(container, ['btrfs', 'subvolume', 'delete',
                              '/var/lib/ceph/osd/ceph-0/current'])
     docker.exec_(container, ['btrfs', 'subvolume', 'delete',
                              '/var/lib/ceph/osd/ceph-0/snap_1'])
     docker.remove([container], force=True, volumes=True)
Пример #17
0
 def fin():
     docker.remove(request.onedata_environment['docker_ids'],
                   force=True,
                   volumes=True)
Пример #18
0
 def teardown_class(cls):
     docker.remove(cls.result['docker_ids'], force=True, volumes=True)
Пример #19
0
#!/usr/bin/env python

"""Author: Konrad Zemek
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'

Cleans up Docker containers given by their name or id. Running containers are
killed first. Volumes are not removed automatically.

Run the script with -h flag to learn about script's running options.
"""

import argparse

from environment import docker


parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Clean up dockers.')

parser.add_argument(
    'docker_ids',
    action='store',
    nargs='*',
    help='IDs of dockers to be cleaned up')

args = parser.parse_args()

docker.remove(args.docker_ids, force=True)