Ejemplo n.º 1
0
def test_sync(user_domain, megabytes, device_host):

    sync_file = 'test.file-{0}'.format(megabytes)
    if os.path.isfile(sync_file):
        os.remove(sync_file)
    print(
        check_output('dd if=/dev/zero of={0} count={1} bs=1M'.format(
            sync_file, megabytes),
                     shell=True))
    print(
        check_output(webdav_upload(DEVICE_USER, DEVICE_PASSWORD, sync_file,
                                   sync_file, user_domain),
                     shell=True))

    sync_file_download = 'test.file.download'
    if os.path.isfile(sync_file_download):
        os.remove(sync_file_download)
    print(
        check_output(webdav_download(DEVICE_USER, DEVICE_PASSWORD, sync_file,
                                     sync_file_download, user_domain),
                     shell=True))

    assert os.path.isfile(sync_file_download)
    run_ssh(device_host,
            'rm /data/owncloud/{0}/files/{1}'.format(DEVICE_USER, sync_file),
            password=DEVICE_PASSWORD)
    files_scan(device_host)
Ejemplo n.º 2
0
def test_protocol(auth, public_web_session):

    email, password, domain, version, arch, release = auth

    run_ssh('cp /integration/event/on_domain_change.py /opt/app/platform/bin', password=DEVICE_PASSWORD)

    response = public_web_session.get('http://localhost/rest/settings/protocol')
    assert '"protocol": "http"' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/settings/set_protocol',
                                      params={'protocol': 'https'})
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/settings/protocol')
    assert '"protocol": "https"' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/settings/set_protocol',
                                      params={'protocol': 'http'})
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/settings/protocol')
    assert '"protocol": "http"' in response.text
    assert response.status_code == 200

    assert run_ssh('cat /tmp/on_domain_change.log', password=DEVICE_PASSWORD) == '{0}.{1}'.format(domain, SYNCLOUD_INFO)
Ejemplo n.º 3
0
def __local_install(app_archive_path, device_host):
    run_scp('{0} root@{1}:/app.tar.gz'.format(app_archive_path, device_host),
            password=DEVICE_PASSWORD)
    run_ssh(device_host,
            '/opt/app/sam/bin/sam --debug install /app.tar.gz',
            password=DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 4
0
def local_install(password, app_archive_path, installer):
    _, app_archive = split(app_archive_path)
    run_scp('{0} root@localhost:/'.format(app_archive_path), password=password)
    cmd = SAM_INSTALL
    if installer == 'snapd':
        cmd = SNAP_INSTALL
    run_ssh('{0} /{1}'.format(cmd, app_archive), password=password)
Ejemplo n.º 5
0
def test_external_mode(auth, public_web_session):

    email, password, domain, version, arch, release = auth

    run_ssh('cp /integration/event/on_domain_change.py /opt/app/platform/bin',
            password=DEVICE_PASSWORD)

    response = public_web_session.get(
        'http://localhost/rest/settings/external_access')
    assert '"external_access": false' in response.text
    assert response.status_code == 200

    response = public_web_session.get(
        'http://localhost/rest/settings/set_external_access',
        params={'external_access': 'False'})
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get(
        'http://localhost/rest/settings/external_access')
    assert '"external_access": false' in response.text
    assert response.status_code == 200

    assert run_ssh('cat /tmp/on_domain_change.log',
                   password=DEVICE_PASSWORD) == '{0}.{1}'.format(
                       domain, SYNCLOUD_INFO)
Ejemplo n.º 6
0
def test_disk_physical_remove(loop_device, public_web_session):
    disk_create(loop_device, 'ext4')
    assert disk_activate(loop_device,  public_web_session) == '/opt/disk/external/platform'
    loop_device_cleanup(password=DEVICE_PASSWORD)
    run_ssh('udevadm trigger --action=remove -y loop0', password=DEVICE_PASSWORD)
    run_ssh('udevadm settle', password=DEVICE_PASSWORD)
    assert current_disk_link() == '/opt/disk/internal/platform'
Ejemplo n.º 7
0
def module_teardown(device_host, data_dir, platform_data_dir):
    platform_log_dir = join(LOG_DIR, 'platform_log')
    os.mkdir(platform_log_dir)
    run_ssh(device_host,
            'ls -la {0}'.format(data_dir),
            password=LOGS_SSH_PASSWORD,
            throw=False)

    run_scp('root@{0}:{1}/log/* {2}'.format(device_host, platform_data_dir,
                                            platform_log_dir),
            password=LOGS_SSH_PASSWORD,
            throw=False)
    run_scp('root@{0}:/var/log/sam.log {1}'.format(device_host,
                                                   platform_log_dir),
            password=LOGS_SSH_PASSWORD,
            throw=False)

    app_log_dir = join(LOG_DIR, 'diaspora_log')
    os.mkdir(app_log_dir)
    run_scp('root@{0}:{1}/log/*.log {2}'.format(device_host, data_dir,
                                                app_log_dir),
            password=LOGS_SSH_PASSWORD,
            throw=False)
    #run_scp('root@{0}:/opt/app/diaspora/diaspora/log/*.log {1}'.format(device_host, app_log_dir),
    #        password=LOGS_SSH_PASSWORD, throw=False)

    print('systemd logs')
    run_ssh(device_host, 'journalctl | tail -200', password=LOGS_SSH_PASSWORD)
Ejemplo n.º 8
0
def test_disk_physical_remove(loop_device, public_web_session):
    disk_create(loop_device, 'ext4')
    assert disk_activate(loop_device,
                         public_web_session) == '/opt/disk/external/platform'
    loop_device_cleanup(password=DEVICE_PASSWORD)
    run_ssh('udevadm trigger --action=remove -y loop0',
            password=DEVICE_PASSWORD)
    run_ssh('udevadm settle', password=DEVICE_PASSWORD)
    assert current_disk_link() == '/opt/disk/internal/platform'
Ejemplo n.º 9
0
def test_activate_device(auth):
    email, password, domain, release, version, arch = auth

    run_ssh('/opt/app/sam/bin/sam update --release {0}'.format(release), password=DEFAULT_DEVICE_PASSWORD)
    run_ssh('/opt/app/sam/bin/sam --debug upgrade platform', password=DEFAULT_DEVICE_PASSWORD)

    response = requests.post('http://localhost:81/rest/activate',
                             data={'main_domain': 'syncloud.info', 'redirect_email': email, 'redirect_password': password,
                                   'user_domain': domain, 'device_username': DEVICE_USER, 'device_password': DEVICE_PASSWORD})
    assert response.status_code == 200
Ejemplo n.º 10
0
def test_copy_logs():
    os.mkdir(LOG_DIR)
    run_scp('root@localhost:/opt/data/platform/log/* {0}'.format(LOG_DIR), password=DEVICE_PASSWORD)
    run_ssh('ls -la /opt/app/diaspora/diaspora/log', password=DEVICE_PASSWORD)
    run_scp('root@localhost:/opt/app/diaspora/diaspora/log/* {0}'.format(LOG_DIR), password=DEVICE_PASSWORD)

    print('-------------------------------------------------------')
    print('syncloud docker image is running')
    print('connect using: {0}'.format(ssh_command(DEVICE_PASSWORD, SSH)))
    print('-------------------------------------------------------')
Ejemplo n.º 11
0
def module_teardown():
    os.mkdir(LOG_DIR)
    run_scp('root@localhost:/opt/data/platform/log/* {0}'.format(LOG_DIR), password=LOGS_SSH_PASSWORD)

    print('systemd logs')
    run_ssh('journalctl | grep platform', password=LOGS_SSH_PASSWORD)

    print('-------------------------------------------------------')
    print('syncloud docker image is running')
    print('connect using: {0}'.format(ssh_command(DEVICE_PASSWORD, SSH)))
    print('-------------------------------------------------------')
Ejemplo n.º 12
0
def __local_install(auth):
    email, password, domain, release, version, arch = auth
    run_scp('{0}/../owncloud-{1}-{2}.tar.gz root@localhost:/'.format(
        DIR, version, arch),
            password=DEVICE_PASSWORD)
    run_ssh(
        '/opt/app/sam/bin/sam --debug install /owncloud-{0}-{1}.tar.gz'.format(
            version, arch),
        password=DEVICE_PASSWORD)
    set_docker_ssh_port(DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 13
0
def module_teardown():
    os.mkdir(LOG_DIR)
    run_scp('root@localhost:/opt/data/platform/log/* {0}'.format(LOG_DIR),
            password=LOGS_SSH_PASSWORD)

    print('systemd logs')
    run_ssh('journalctl | grep platform', password=LOGS_SSH_PASSWORD)

    print('-------------------------------------------------------')
    print('syncloud docker image is running')
    print('connect using: {0}'.format(ssh_command(DEVICE_PASSWORD, SSH)))
    print('-------------------------------------------------------')
Ejemplo n.º 14
0
def test_hook_override(public_web_session, conf_dir, service_prefix):

    run_ssh(
        "sed -i 's#hooks_root.*#hooks_root: /integration#g' {0}/config/platform.cfg"
        .format(conf_dir),
        password=DEVICE_PASSWORD)

    run_ssh(
        'systemctl restart {0}platform.uwsgi-public'.format(service_prefix),
        password=DEVICE_PASSWORD)

    wait_for_rest(public_web_session, '/', 200)
Ejemplo n.º 15
0
def test_activate_device(auth, device_host):
    email, password, domain, release = auth

    run_ssh(device_host, '/opt/app/sam/bin/sam update --release {0}'.format(release), password=DEFAULT_DEVICE_PASSWORD)
    run_ssh(device_host, '/opt/app/sam/bin/sam --debug upgrade platform', password=DEFAULT_DEVICE_PASSWORD)

    response = requests.post('http://{0}:81/rest/activate'.format(device_host),
                             data={'main_domain': SYNCLOUD_INFO, 'redirect_email': email, 'redirect_password': password,
                                   'user_domain': domain, 'device_username': DEVICE_USER, 'device_password': DEVICE_PASSWORD})
    assert response.status_code == 200, response.text
    global LOGS_SSH_PASSWORD
    LOGS_SSH_PASSWORD = DEVICE_PASSWORD
Ejemplo n.º 16
0
def module_teardown(device_host):
    platform_log_dir = join(LOG_DIR, 'platform_log')
    os.mkdir(platform_log_dir)
    run_scp('root@{0}:/opt/data/platform/log/* {1}'.format(device_host, platform_log_dir), password=LOGS_SSH_PASSWORD, throw=False)

    run_scp('root@{0}:/var/log/sam.log {1}'.format(device_host, platform_log_dir), password=LOGS_SSH_PASSWORD, throw=False)

    print('systemd logs')
    run_ssh(device_host, 'journalctl | tail -200', password=LOGS_SSH_PASSWORD, throw=False)

    app_log_dir = join(LOG_DIR, 'owncloud_log')
    os.mkdir(app_log_dir)
    run_scp('root@{0}:/opt/data/owncloud/log/*.log {1}'.format(device_host, app_log_dir), password=LOGS_SSH_PASSWORD, throw=False)
Ejemplo n.º 17
0
def disk_activate(loop_device,  public_web_session):

    run_ssh('cp /integration/event/on_disk_change.py /opt/app/platform/bin', password=DEVICE_PASSWORD)

    response = public_web_session.get('http://localhost/rest/settings/disks')
    print response.text
    assert loop_device in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/settings/disk_activate',
                                      params={'device': loop_device})
    assert response.status_code == 200
    return current_disk_link()
Ejemplo n.º 18
0
def loop_device():
    dev_file = '/tmp/disk'
    loop_device_cleanup(dev_file, password=DEVICE_PASSWORD)

    print('adding loop device')
    run_ssh('dd if=/dev/zero bs=1M count=10 of={0}'.format(dev_file),
            password=DEVICE_PASSWORD)
    loop = run_ssh('losetup -f --show {0}'.format(dev_file),
                   password=DEVICE_PASSWORD)
    run_ssh('file -s {0}'.format(loop), password=DEVICE_PASSWORD)

    yield loop

    loop_device_cleanup(dev_file, password=DEVICE_PASSWORD)
Ejemplo n.º 19
0
def module_teardown():
    run_scp('root@localhost:{0}/log/* {1}'.format(DATA_DIR, LOG_DIR),
            password=LOGS_SSH_PASSWORD)
    run_scp('root@localhost:/var/log/sam.log {1}'.format(DATA_DIR, LOG_DIR),
            throw=False,
            password=LOGS_SSH_PASSWORD)

    print('systemd logs')
    run_ssh('journalctl | tail -200', password=LOGS_SSH_PASSWORD)

    print('-------------------------------------------------------')
    print('syncloud docker image is running')
    print('connect using: {0}'.format(ssh_command(DEVICE_PASSWORD, SSH)))
    print('-------------------------------------------------------')
Ejemplo n.º 20
0
def disk_activate(loop_device, public_web_session):

    run_ssh('cp /integration/event/on_disk_change.py /opt/app/platform/bin',
            password=DEVICE_PASSWORD)

    response = public_web_session.get('http://localhost/rest/settings/disks')
    print response.text
    assert loop_device in response.text
    assert response.status_code == 200

    response = public_web_session.get(
        'http://localhost/rest/settings/disk_activate',
        params={'device': loop_device})
    assert response.status_code == 200
    return current_disk_link()
Ejemplo n.º 21
0
def test_sync(user_domain, megabytes, device_host):

    sync_file = 'test.file-{0}'.format(megabytes)
    if os.path.isfile(sync_file):
        os.remove(sync_file)
    print(check_output('dd if=/dev/zero of={0} count={1} bs=1M'.format(sync_file, megabytes), shell=True))
    print(check_output(webdav_upload(DEVICE_USER, DEVICE_PASSWORD, sync_file, sync_file, user_domain), shell=True))

    sync_file_download = 'test.file.download'
    if os.path.isfile(sync_file_download):
        os.remove(sync_file_download)
    print(check_output(webdav_download(DEVICE_USER, DEVICE_PASSWORD, sync_file, sync_file_download, user_domain), shell=True))

    assert os.path.isfile(sync_file_download)
    run_ssh(device_host, 'rm /data/owncloud/{0}/files/{1}'.format(DEVICE_USER, sync_file), password=DEVICE_PASSWORD)
    files_scan(device_host)
Ejemplo n.º 22
0
def loop_device_add(fs, dev_num, pasword):

    print('adding loop device')
    run_ssh('dd if=/dev/zero bs=1M count=10 of=/tmp/disk{0}'.format(dev_num), password=pasword)

    run_ssh('losetup /dev/loop{0} /tmp/disk{0}'.format(dev_num), password=pasword)
    run_ssh('file -s /dev/loop{0}'.format(dev_num), password=pasword)
    run_ssh('mkfs.{0} /dev/loop{1}'.format(fs, dev_num), password=pasword)
    return '/dev/loop{0}'.format(dev_num)
Ejemplo n.º 23
0
def loop_device_add(host, fs, dev_file, password):
    print('adding loop device')
    run_ssh(host, 'dd if=/dev/zero bs=1M count=10 of={0}'.format(dev_file), password=password)
    loop = run_ssh(host, 'losetup -f --show {0}'.format(dev_file), password=password)
    run_ssh(host, 'file -s {0}'.format(loop), password=password)
    run_ssh(host, 'mkfs.{0} {1}'.format(fs, loop), password=password)
    return loop
Ejemplo n.º 24
0
def _test_sync(user_domain, megabites):

    sync_dir_upload = 'sync.test.upload'
    sync_file = 'test.file-{0}'.format(megabites)
    shutil.rmtree(sync_dir_upload, ignore_errors=True)
    os.mkdir(sync_dir_upload)
    sync_full_path_file = join(sync_dir_upload, sync_file)
    print(check_output('dd if=/dev/zero of={0} count={1} bs=1M'.format(sync_full_path_file, megabites), shell=True))
    print(check_output(sync_cmd(sync_dir_upload, user_domain), shell=True))

    sync_dir_download = 'sync.test.download'
    shutil.rmtree(sync_dir_download, ignore_errors=True)
    os.mkdir(sync_dir_download)
    print(check_output(sync_cmd(sync_dir_download, user_domain), shell=True))
    sync_full_path_file = join(sync_dir_download, sync_file)

    assert os.path.isfile(sync_full_path_file)
    run_ssh('rm /data/owncloud/{0}/files/{1}'.format(DEVICE_USER, sync_file), password=DEVICE_PASSWORD)
    files_scan()
Ejemplo n.º 25
0
def module_teardown(device_host):
    platform_log_dir = join(LOG_DIR, 'platform_log')
    os.mkdir(platform_log_dir)
    run_scp('root@{0}:/opt/data/platform/log/* {1}'.format(
        device_host, platform_log_dir),
            password=LOGS_SSH_PASSWORD)

    run_scp('root@{0}:/var/log/sam.log {1}'.format(device_host,
                                                   platform_log_dir),
            password=LOGS_SSH_PASSWORD)

    print('systemd logs')
    run_ssh(device_host, 'journalctl | tail -200', password=LOGS_SSH_PASSWORD)

    app_log_dir = join(LOG_DIR, 'owncloud_log')
    os.mkdir(app_log_dir)
    run_scp('root@{0}:/opt/data/owncloud/log/*.log {1}'.format(
        device_host, app_log_dir),
            password=LOGS_SSH_PASSWORD)
Ejemplo n.º 26
0
def test_activate_device(auth):
    email, password, domain, release, version, arch = auth

    run_ssh('/opt/app/sam/bin/sam update --release {0}'.format(release),
            password=DEFAULT_DEVICE_PASSWORD)
    run_ssh('/opt/app/sam/bin/sam --debug upgrade platform',
            password=DEFAULT_DEVICE_PASSWORD)

    response = requests.post('http://localhost:81/rest/activate',
                             data={
                                 'main_domain': SYNCLOUD_INFO,
                                 'redirect_email': email,
                                 'redirect_password': password,
                                 'user_domain': domain,
                                 'device_username': DEVICE_USER,
                                 'device_password': DEVICE_PASSWORD
                             })
    assert response.status_code == 200, response.text
    global LOGS_SSH_PASSWORD
    LOGS_SSH_PASSWORD = DEVICE_PASSWORD
Ejemplo n.º 27
0
def __local_install(password, version, arch, release):
    run_scp('{0}/../platform-{1}-{2}.tar.gz root@localhost:/'.format(DIR, version, arch), password=password)
    run_ssh('/opt/app/sam/bin/sam --debug install /platform-{0}-{1}.tar.gz'.format(version, arch), password=password)
    run_ssh('/opt/app/sam/bin/sam update --release {0}'.format(release), password=password)
    set_docker_ssh_port(password)
    run_ssh('systemctl restart platform-uwsgi-public', password=password)
    time.sleep(3)
Ejemplo n.º 28
0
def loop_device_add(host, fs, dev_file, password):
    print('adding loop device')
    run_ssh(host,
            'dd if=/dev/zero bs=1M count=10 of={0}'.format(dev_file),
            password=password)
    loop = run_ssh(host,
                   'losetup -f --show {0}'.format(dev_file),
                   password=password)
    run_ssh(host, 'file -s {0}'.format(loop), password=password)
    run_ssh(host, 'mkfs.{0} {1}'.format(fs, loop), password=password)
    return loop
Ejemplo n.º 29
0
def _test_sync(user_domain, megabites):

    sync_dir_upload = 'sync.test.upload'
    sync_file = 'test.file-{0}'.format(megabites)
    shutil.rmtree(sync_dir_upload, ignore_errors=True)
    os.mkdir(sync_dir_upload)
    sync_full_path_file = join(sync_dir_upload, sync_file)
    print(
        check_output('dd if=/dev/zero of={0} count={1} bs=1M'.format(
            sync_full_path_file, megabites),
                     shell=True))
    print(check_output(sync_cmd(sync_dir_upload, user_domain), shell=True))

    sync_dir_download = 'sync.test.download'
    shutil.rmtree(sync_dir_download, ignore_errors=True)
    os.mkdir(sync_dir_download)
    print(check_output(sync_cmd(sync_dir_download, user_domain), shell=True))
    sync_full_path_file = join(sync_dir_download, sync_file)

    assert os.path.isfile(sync_full_path_file)
    run_ssh('rm /data/owncloud/{0}/files/{1}'.format(DEVICE_USER, sync_file),
            password=DEVICE_PASSWORD)
    files_scan()
Ejemplo n.º 30
0
def loop_device():

    loop_device_cleanup(password=DEVICE_PASSWORD)

    print('adding loop device')
    run_ssh('dd if=/dev/zero bs=1M count=10 of=/tmp/disk', password=DEVICE_PASSWORD)
    run_ssh('losetup /dev/loop0 /tmp/disk', password=DEVICE_PASSWORD)
    run_ssh('file -s /dev/loop0', password=DEVICE_PASSWORD)

    yield '/dev/loop0'

    loop_device_cleanup(password=DEVICE_PASSWORD)
Ejemplo n.º 31
0
def loop_device():

    loop_device_cleanup(password=DEVICE_PASSWORD)

    print('adding loop device')
    run_ssh('dd if=/dev/zero bs=1M count=10 of=/tmp/disk',
            password=DEVICE_PASSWORD)
    run_ssh('losetup /dev/loop0 /tmp/disk', password=DEVICE_PASSWORD)
    run_ssh('file -s /dev/loop0', password=DEVICE_PASSWORD)

    yield '/dev/loop0'

    loop_device_cleanup(password=DEVICE_PASSWORD)
Ejemplo n.º 32
0
def __local_install(password, version, arch, release):
    run_scp('{0}/../platform-{1}-{2}.tar.gz root@localhost:/'.format(
        DIR, version, arch),
            password=password)
    run_ssh(
        '/opt/app/sam/bin/sam --debug install /platform-{0}-{1}.tar.gz'.format(
            version, arch),
        password=password)
    run_ssh('/opt/app/sam/bin/sam update --release {0}'.format(release),
            password=password)
    set_docker_ssh_port(password)
    run_ssh('systemctl restart platform-uwsgi-public', password=password)
    time.sleep(3)
Ejemplo n.º 33
0
def test_protocol(auth, public_web_session, conf_dir, service_prefix):

    email, password, domain, app_archive_path = auth

    response = public_web_session.get('http://localhost/rest/access/access')
    assert '"is_https": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get(
        'http://localhost/rest/access/set_access',
        params={
            'is_https': 'true',
            'upnp_enabled': 'false',
            'external_access': 'false',
            'public_ip': 0,
            'public_port': 0
        })
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/access/access')
    assert '"is_https": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get(
        'http://localhost/rest/access/set_access',
        params={
            'is_https': 'false',
            'upnp_enabled': 'false',
            'external_access': 'false',
            'public_ip': 0,
            'public_port': 0
        })
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = public_web_session.get('http://localhost/rest/access/access')
    assert '"is_https": false' in response.text
    assert response.status_code == 200

    assert run_ssh('cat /tmp/on_domain_change.log',
                   password=DEVICE_PASSWORD) == '{0}.{1}'.format(
                       domain, SYNCLOUD_INFO)
Ejemplo n.º 34
0
def loop_device_cleanup(password):
    print('cleanup')
    for mount in run_ssh('mount', password=password).splitlines():
        if 'loop' in mount:
            print(mount)
            run_ssh('umount /dev/loop0', throw=False, password=password)

    for loop in run_ssh('losetup', password=password).splitlines():
        if 'loop0' in loop:
            run_ssh('losetup -d /dev/loop0', throw=False, password=password)

    run_ssh('losetup', password=password)

    for loop in run_ssh('dmsetup ls', password=password).splitlines():
        if 'loop0p1' in loop:
            run_ssh('sudo dmsetup remove loop0p1', password=password)
        if 'loop0p2' in loop:
            run_ssh('sudo dmsetup remove loop0p2', password=password)

    for loop_disk in run_ssh('ls -la /tmp', password=password).splitlines():
        if '/tmp/disk' in loop_disk:
            run_ssh('rm -rf /tmp/disk', throw=False, password=password)
Ejemplo n.º 35
0
def test_remove():
    run_ssh('/opt/app/sam/bin/sam --debug remove platform',
            password=DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 36
0
def cron_is_enabled_after_install():
    crontab = run_ssh("crontab -l", password=DEVICE_PASSWORD)
    assert len(crontab.splitlines()) == 1
    assert 'sync' in crontab, crontab
    assert not crontab.startswith('#'), crontab
Ejemplo n.º 37
0
def cron_is_enabled_after_install():
    crontab = run_ssh("crontab -l", password=DEVICE_PASSWORD)
    assert len(crontab.splitlines()) == 1
    assert 'sync' in crontab, crontab
    assert not crontab.startswith('#'), crontab
Ejemplo n.º 38
0
def current_disk_link():
    return run_ssh('cat /tmp/on_disk_change.log', password=DEVICE_PASSWORD)
Ejemplo n.º 39
0
def files_scan():
    run_ssh('/opt/app/owncloud/bin/occ-runner files:scan --all', password=DEVICE_PASSWORD)
Ejemplo n.º 40
0
def test_phpinfo(device_host):
    run_ssh(device_host, '/opt/app/owncloud/bin/php-runner -i > /opt/data/owncloud/log/phpinfo.log', password=DEVICE_PASSWORD)
Ejemplo n.º 41
0
def test_occ(device_host):
    run_ssh(device_host,
            '/opt/app/owncloud/bin/occ-runner',
            password=DEVICE_PASSWORD)
Ejemplo n.º 42
0
def test_phpinfo(device_host):
    run_ssh(
        device_host,
        '/opt/app/owncloud/bin/php-runner -i > /opt/data/owncloud/log/phpinfo.log',
        password=DEVICE_PASSWORD)
Ejemplo n.º 43
0
def loop_device_cleanup(host, dev_file, password):
    print('cleanup')
    for mount in run_ssh(host, 'mount', password=password).splitlines():
        if dev_file in mount:
            print(mount)
            for i in range(0, 20):
                if 'loop{0}'.format(i) in mount:
                    run_ssh(host, 'umount /dev/loop{0}'.format(i), throw=False, password=password)

    for loop in run_ssh(host, 'losetup', password=password).splitlines():
        if dev_file in loop or 'deleted' in loop:
            for i in range(0, 20):
                if 'loop{0}'.format(i) in loop:
                    run_ssh(host, 'losetup -d /dev/loop{0}'.format(i), throw=False, password=password)

    run_ssh(host, 'losetup', password=password)

    for loop in run_ssh(host, 'dmsetup ls', password=password).splitlines():
        if 'loop0p1' in loop:
            run_ssh(host, 'sudo dmsetup remove loop0p1', password=password)
        if 'loop0p2' in loop:
            run_ssh(host, 'sudo dmsetup remove loop0p2', password=password)

    run_ssh(host, 'rm -rf {0}'.format(dev_file), throw=False, password=password)
Ejemplo n.º 44
0
def __local_install(app_archive_path, device_host):
    run_scp('{0} root@{1}:/app.tar.gz'.format(app_archive_path, device_host), password=DEVICE_PASSWORD)
    run_ssh(device_host, '/opt/app/sam/bin/sam --debug install /app.tar.gz', password=DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 45
0
def disk_writable():
    run_ssh('ls -la /data/', password=DEVICE_PASSWORD)
    run_ssh("su - platform -s /bin/bash -c 'touch /data/platform/test.file'", password=DEVICE_PASSWORD)
Ejemplo n.º 46
0
def disk_create(loop_device, fs):
    run_ssh('mkfs.{0} {1}'.format(fs, loop_device), password=DEVICE_PASSWORD)

    run_ssh('rm -rf /tmp/test', password=DEVICE_PASSWORD)
    run_ssh('mkdir /tmp/test', password=DEVICE_PASSWORD)

    run_ssh('mount {0} /tmp/test'.format(loop_device), password=DEVICE_PASSWORD)
    for mount in run_ssh('mount', debug=True, password=DEVICE_PASSWORD).splitlines():
        if 'loop' in mount:
            print(mount)
    run_ssh('umount {0}'.format(loop_device), password=DEVICE_PASSWORD)

    run_ssh('udisksctl mount -b {0}'.format(loop_device), password=DEVICE_PASSWORD)
    for mount in run_ssh('mount', debug=True, password=DEVICE_PASSWORD).splitlines():
        if 'loop' in mount:
            print(mount)
    run_ssh('udisksctl unmount -b {0}'.format(loop_device), password=DEVICE_PASSWORD)
Ejemplo n.º 47
0
def current_disk_link():
    return run_ssh('cat /tmp/on_disk_change.log', password=DEVICE_PASSWORD)
Ejemplo n.º 48
0
def files_scan(device_host):
    run_ssh(device_host,
            '/opt/app/owncloud/bin/occ-runner files:scan --all',
            password=DEVICE_PASSWORD)
Ejemplo n.º 49
0
def disk_writable():
    run_ssh('ls -la /data/', password=DEVICE_PASSWORD)
    run_ssh("su - platform -s /bin/bash -c 'touch /data/platform/test.file'",
            password=DEVICE_PASSWORD)
Ejemplo n.º 50
0
def __log_data_dir(device_host):
    run_ssh(device_host, 'ls -la /data', password=DEVICE_PASSWORD)
    run_ssh(device_host, 'ls -la /data/', password=DEVICE_PASSWORD)
    run_ssh(device_host, 'ls -la /data/owncloud', password=DEVICE_PASSWORD)
Ejemplo n.º 51
0
def test_cron_job(auth, public_web_session):
    assert '"success": true' in run_ssh('/opt/app/platform/bin/insider sync_all', password=DEVICE_PASSWORD)
Ejemplo n.º 52
0
def loop_device_cleanup(num, password):
    print('cleanup')
    for mount in run_ssh('mount', password=password).splitlines():
        if 'loop' in mount:
            print(mount)

    for loop in run_ssh('losetup', password=password).splitlines():
        if 'loop{0}'.format(num) in loop:
            run_ssh('losetup -d /dev/loop{0}'.format(num), throw=False, password=password)

    run_ssh('losetup', password=password)

    for loop in run_ssh('dmsetup ls', password=password).splitlines():
        if 'loop{0}'.format(num) in loop:
            run_ssh('sudo dmsetup remove loop{0}p1'.format(num), password=password)

    for loop_disk in run_ssh('ls -la /tmp', password=password).splitlines():
        if '/tmp/disk{0}'.format(num) in loop_disk:
            run_ssh('rm -fr /tmp/disk{0}'.format(num), throw=False, password=password)
Ejemplo n.º 53
0
def disk_create(loop_device, fs):
    run_ssh('mkfs.{0} {1}'.format(fs, loop_device), password=DEVICE_PASSWORD)

    run_ssh('rm -rf /tmp/test', password=DEVICE_PASSWORD)
    run_ssh('mkdir /tmp/test', password=DEVICE_PASSWORD)

    run_ssh('mount {0} /tmp/test'.format(loop_device),
            password=DEVICE_PASSWORD)
    for mount in run_ssh('mount', debug=True,
                         password=DEVICE_PASSWORD).splitlines():
        if 'loop' in mount:
            print(mount)
    run_ssh('umount {0}'.format(loop_device), password=DEVICE_PASSWORD)

    run_ssh('udisksctl mount -b {0}'.format(loop_device),
            password=DEVICE_PASSWORD)
    for mount in run_ssh('mount', debug=True,
                         password=DEVICE_PASSWORD).splitlines():
        if 'loop' in mount:
            print(mount)
    run_ssh('udisksctl unmount -b {0}'.format(loop_device),
            password=DEVICE_PASSWORD)
Ejemplo n.º 54
0
def test_occ(device_host):
    run_ssh(device_host, '/opt/app/owncloud/bin/occ-runner', password=DEVICE_PASSWORD)
Ejemplo n.º 55
0
def test_remove():
    run_ssh('/opt/app/sam/bin/sam --debug remove platform', password=DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 56
0
def __local_install(auth):
    email, password, domain, release, version, arch = auth
    run_scp('{0}/../owncloud-{1}-{2}.tar.gz root@localhost:/'.format(DIR, version, arch), password=DEVICE_PASSWORD)
    run_ssh('/opt/app/sam/bin/sam --debug install /owncloud-{0}-{1}.tar.gz'.format(version, arch), password=DEVICE_PASSWORD)
    set_docker_ssh_port(DEVICE_PASSWORD)
    time.sleep(3)
Ejemplo n.º 57
0
def __log_data_dir(device_host):
    run_ssh(device_host, 'ls -la /data', password=DEVICE_PASSWORD)
    run_ssh(device_host, 'ls -la /data/', password=DEVICE_PASSWORD)
    run_ssh(device_host, 'ls -la /data/owncloud', password=DEVICE_PASSWORD)