-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade to Radicale 3.2.0 (#147)
* chore: upgrade to Radicale 3.2.0 * doc: update changelog * chore: update config with Radicale one (only comments were changed) * doc: use pipenv to run test to avoid activating the env * style: reformat test_image_prod.py * fix(test): version must be 3.2.0 to support new hook section in config * style: reformat python using ruff
- Loading branch information
Showing
6 changed files
with
109 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,69 @@ | ||
import subprocess | ||
|
||
import pytest | ||
import subprocess | ||
import testinfra | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
@pytest.fixture(scope="session") | ||
def host(): | ||
subprocess.check_call(['docker', 'build', '-t', 'radicale-under-test', '.']) | ||
docker_id = subprocess.check_output([ | ||
'docker', 'run', '-d', | ||
'--init', | ||
'--read-only', | ||
'--security-opt=no-new-privileges:true', | ||
# Not able to use cap-drop=all and make the container start | ||
# '--cap-drop', 'ALL', | ||
# '--cap-add', 'SYS_ADMIN', | ||
# '--cap-add', 'CHOWN', | ||
# '--cap-add', 'SETUID', | ||
# '--cap-add', 'SETGID', | ||
# '--cap-add', 'KILL', | ||
'--pids-limit', '50', | ||
'--memory', '256M', | ||
'radicale-under-test' | ||
]).decode().strip() | ||
subprocess.check_call(["docker", "build", "-t", "radicale-under-test", "."]) | ||
docker_id = ( | ||
subprocess.check_output( | ||
[ | ||
"docker", | ||
"run", | ||
"-d", | ||
"--init", | ||
"--read-only", | ||
"--security-opt=no-new-privileges:true", | ||
# Not able to use cap-drop=all and make the container start | ||
# '--cap-drop', 'ALL', | ||
# '--cap-add', 'SYS_ADMIN', | ||
# '--cap-add', 'CHOWN', | ||
# '--cap-add', 'SETUID', | ||
# '--cap-add', 'SETGID', | ||
# '--cap-add', 'KILL', | ||
"--pids-limit", | ||
"50", | ||
"--memory", | ||
"256M", | ||
"radicale-under-test", | ||
] | ||
) | ||
.decode() | ||
.strip() | ||
) | ||
|
||
yield testinfra.get_host("docker://" + docker_id) | ||
|
||
# teardown | ||
subprocess.check_call(['docker', 'rm', '-f', docker_id]) | ||
subprocess.check_call(["docker", "rm", "-f", docker_id]) | ||
|
||
|
||
def test_process(host): | ||
process = host.process.get(comm='radicale') | ||
process = host.process.get(comm="radicale") | ||
assert process.pid != 1 | ||
assert process.user == 'radicale' | ||
assert process.group == 'radicale' | ||
assert process.user == "radicale" | ||
assert process.group == "radicale" | ||
|
||
|
||
def test_port(host): | ||
assert host.socket('tcp://0.0.0.0:5232').is_listening | ||
assert host.socket("tcp://0.0.0.0:5232").is_listening | ||
|
||
|
||
def test_version(host): | ||
assert host.check_output('/venv/bin/radicale --version') == '3.1.9' | ||
assert host.check_output("/venv/bin/radicale --version") == "3.2.0" | ||
|
||
|
||
def test_user(host): | ||
user = 'radicale' | ||
user = "radicale" | ||
assert host.user(user).uid == 2999 | ||
assert host.user(user).gid == 2999 | ||
assert host.user(user).shell == '/bin/false' | ||
assert 'radicale L ' in host.check_output('passwd --status radicale') | ||
assert host.user(user).shell == "/bin/false" | ||
assert "radicale L " in host.check_output("passwd --status radicale") | ||
|
||
|
||
def test_data_folder_writable(host): | ||
folder = '/data' | ||
assert host.file(folder).user == 'radicale' | ||
assert host.file(folder).group == 'radicale' | ||
folder = "/data" | ||
assert host.file(folder).user == "radicale" | ||
assert host.file(folder).group == "radicale" | ||
assert host.file(folder).mode == 0o770 |