mirror of
https://github.com/laurivosandi/certidude
synced 2024-11-15 01:16:45 +00:00
tests: Correct tests for hourly and daily cronjobs
This commit is contained in:
parent
1bbbf24373
commit
68d4af15dc
@ -163,6 +163,7 @@ def clean_server():
|
|||||||
"/etc/certidude/builder.conf",
|
"/etc/certidude/builder.conf",
|
||||||
"/etc/certidude/profile.conf",
|
"/etc/certidude/profile.conf",
|
||||||
"/var/log/certidude.log",
|
"/var/log/certidude.log",
|
||||||
|
"/etc/cron.daily/certidude",
|
||||||
"/etc/cron.hourly/certidude",
|
"/etc/cron.hourly/certidude",
|
||||||
"/etc/systemd/system/certidude.service",
|
"/etc/systemd/system/certidude.service",
|
||||||
"/etc/nginx/sites-available/ca.conf",
|
"/etc/nginx/sites-available/ca.conf",
|
||||||
@ -277,7 +278,6 @@ def test_cli_setup_authority():
|
|||||||
assert_cleanliness()
|
assert_cleanliness()
|
||||||
|
|
||||||
assert os.path.exists("/var/lib/certidude/signed/ca.example.lan.pem"), "provisioning failed"
|
assert os.path.exists("/var/lib/certidude/signed/ca.example.lan.pem"), "provisioning failed"
|
||||||
assert not os.path.exists("/etc/cron.hourly/certidude")
|
|
||||||
|
|
||||||
# Make sure nginx is running
|
# Make sure nginx is running
|
||||||
assert os.system("nginx -t") == 0, "invalid nginx configuration"
|
assert os.system("nginx -t") == 0, "invalid nginx configuration"
|
||||||
@ -1328,6 +1328,7 @@ def test_cli_setup_authority():
|
|||||||
assert not os.path.exists("/var/lib/certidude/ca_key.pem")
|
assert not os.path.exists("/var/lib/certidude/ca_key.pem")
|
||||||
assert os.system("certidude setup authority --skip-packages -o 'Demola LLC'") == 0
|
assert os.system("certidude setup authority --skip-packages -o 'Demola LLC'") == 0
|
||||||
assert os.path.exists("/var/lib/certidude/ca_key.pem")
|
assert os.path.exists("/var/lib/certidude/ca_key.pem")
|
||||||
|
assert os.path.exists("/etc/cron.daily/certidude")
|
||||||
assert os.path.exists("/etc/cron.hourly/certidude")
|
assert os.path.exists("/etc/cron.hourly/certidude")
|
||||||
|
|
||||||
|
|
||||||
@ -1344,10 +1345,6 @@ def test_cli_setup_authority():
|
|||||||
assert os.system("sed -e 's/kerberos subnets =.*/kerberos subnets = 0.0.0.0\\/0/g' -i /etc/certidude/server.conf") == 0
|
assert os.system("sed -e 's/kerberos subnets =.*/kerberos subnets = 0.0.0.0\\/0/g' -i /etc/certidude/server.conf") == 0
|
||||||
|
|
||||||
# Update server credential cache
|
# Update server credential cache
|
||||||
assert os.system("sed -e 's/dc1/ca/g' -i /etc/cron.hourly/certidude") == 0
|
|
||||||
with open("/etc/cron.hourly/certidude") as fh:
|
|
||||||
cronjob = fh.read()
|
|
||||||
assert "ldap/ca.example.lan" in cronjob, cronjob
|
|
||||||
assert os.system("/etc/cron.hourly/certidude") == 0
|
assert os.system("/etc/cron.hourly/certidude") == 0
|
||||||
assert os.path.exists("/run/certidude/krb5cc")
|
assert os.path.exists("/run/certidude/krb5cc")
|
||||||
assert os.stat("/run/certidude/krb5cc").st_uid != 0, "Incorrect persmissions for /run/certidude/krb5cc"
|
assert os.stat("/run/certidude/krb5cc").st_uid != 0, "Incorrect persmissions for /run/certidude/krb5cc"
|
||||||
@ -1510,8 +1507,6 @@ def test_cli_setup_authority():
|
|||||||
|
|
||||||
result = runner.invoke(cli, ['list', '-srv'])
|
result = runner.invoke(cli, ['list', '-srv'])
|
||||||
assert not result.exception, result.output
|
assert not result.exception, result.output
|
||||||
result = runner.invoke(cli, ['expire'])
|
|
||||||
assert not result.exception, result.output
|
|
||||||
|
|
||||||
pid_certidude = int(open("/run/certidude/server.pid").read())
|
pid_certidude = int(open("/run/certidude/server.pid").read())
|
||||||
assert os.system("systemctl stop certidude") == 0
|
assert os.system("systemctl stop certidude") == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user