2024-02-09 12:38:17 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-14 08:21:25 +00:00
|
|
|
test('ConvertCapAdd', function () {
|
2024-02-09 12:38:17 +00:00
|
|
|
$input = '--cap-add=NET_ADMIN --cap-add=NET_RAW --cap-add SYS_ADMIN';
|
|
|
|
$output = convert_docker_run_to_compose($input);
|
|
|
|
expect($output)->toBe([
|
|
|
|
'cap_add' => ['NET_ADMIN', 'NET_RAW', 'SYS_ADMIN'],
|
|
|
|
])->ray();
|
|
|
|
});
|
2024-02-14 07:42:47 +00:00
|
|
|
|
2024-02-25 22:13:27 +00:00
|
|
|
test('ConvertIp', function () {
|
|
|
|
$input = '--cap-add=NET_ADMIN --cap-add=NET_RAW --cap-add SYS_ADMIN --ip 127.0.0.1 --ip 127.0.0.2';
|
|
|
|
$output = convert_docker_run_to_compose($input);
|
|
|
|
expect($output)->toBe([
|
|
|
|
'cap_add' => ['NET_ADMIN', 'NET_RAW', 'SYS_ADMIN'],
|
|
|
|
'ip' => ['127.0.0.1', '127.0.0.2']
|
|
|
|
])->ray();
|
|
|
|
});
|
|
|
|
|
2024-02-14 08:21:25 +00:00
|
|
|
test('ConvertPrivilegedAndInit', function () {
|
2024-02-14 07:42:47 +00:00
|
|
|
$input = '---privileged --init';
|
|
|
|
$output = convert_docker_run_to_compose($input);
|
|
|
|
expect($output)->toBe([
|
|
|
|
'privileged' => true,
|
|
|
|
'init' => true,
|
|
|
|
])->ray();
|
|
|
|
});
|
|
|
|
|
2024-02-14 08:21:25 +00:00
|
|
|
test('ConvertUlimit', function () {
|
2024-02-14 07:42:47 +00:00
|
|
|
$input = '--ulimit nofile=262144:262144';
|
|
|
|
$output = convert_docker_run_to_compose($input);
|
|
|
|
expect($output)->toBe([
|
|
|
|
'ulimits' => [
|
|
|
|
'nofile' => [
|
|
|
|
'soft' => '262144',
|
|
|
|
'hard' => '262144',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
])->ray();
|
|
|
|
});
|