xref: /unit/test/unit/check/chroot.py (revision 1858:a9a5746051aa)
1import json
2
3from unit.http import TestHTTP
4from unit.option import option
5
6http = TestHTTP()
7
8
9def check_chroot():
10    available = option.available
11
12    resp = http.put(
13        url='/config',
14        sock_type='unix',
15        addr=option.temp_dir + '/control.unit.sock',
16        body=json.dumps(
17            {
18                "listeners": {"*:7080": {"pass": "routes"}},
19                "routes": [
20                    {
21                        "action": {
22                            "share": option.temp_dir,
23                            "chroot": option.temp_dir,
24                        }
25                    }
26                ],
27            }
28        ),
29    )
30
31    if 'success' in resp['body']:
32        available['features']['chroot'] = True
33