summaryrefslogtreecommitdiffhomepage
path: root/test/test_ruby_isolation.py
blob: 59c0e5f60495fe5ae8539afbbb8df87613e95473 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from unit.applications.lang.ruby import ApplicationRuby

prerequisites = {'modules': {'ruby': 'any'}, 'features': {'isolation': True}}

client = ApplicationRuby()


def test_ruby_isolation_rootfs(is_su, require, temp_dir):
    isolation = {'rootfs': temp_dir}

    if not is_su:
        require(
            {
                'features': {
                    'isolation': [
                        'unprivileged_userns_clone',
                        'user',
                        'mnt',
                        'pid',
                    ]
                }
            }
        )

        isolation['namespaces'] = {
            'mount': True,
            'credential': True,
            'pid': True,
        }

    client.load('status_int', isolation=isolation)

    assert 'success' in client.conf(
        '"/ruby/status_int/config.ru"',
        'applications/status_int/script',
    )

    assert 'success' in client.conf(
        '"/ruby/status_int"',
        'applications/status_int/working_directory',
    )

    assert client.get()['status'] == 200, 'status int'