3
0
Fork 0
forked from mirrors/nixpkgs

nixos/kerberos: port tests to python

This commit is contained in:
Kai Wohlfahrt 2019-11-23 12:25:27 +00:00
parent be1ce70e6f
commit d28fd8f8da
2 changed files with 26 additions and 41 deletions

View file

@ -1,4 +1,4 @@
import ../make-test.nix ({pkgs, ...}: {
import ../make-test-python.nix ({pkgs, ...}: {
name = "kerberos_server-heimdal";
machine = { config, libs, pkgs, ...}:
{ services.kerberos_server =
@ -23,31 +23,20 @@ import ../make-test.nix ({pkgs, ...}: {
};
testScript = ''
$machine->start;
machine.succeed(
"kadmin -l init --realm-max-ticket-life='8 day' --realm-max-renewable-life='10 day' FOO.BAR",
"systemctl restart kadmind.service kdc.service",
)
$machine->succeed(
"kadmin -l init --realm-max-ticket-life='8 day' \\
--realm-max-renewable-life='10 day' FOO.BAR"
);
for unit in ["kadmind", "kdc", "kpasswdd"]:
machine.wait_for_unit(f"{unit}.service")
$machine->succeed("systemctl restart kadmind.service kdc.service");
$machine->waitForUnit("kadmind.service");
$machine->waitForUnit("kdc.service");
$machine->waitForUnit("kpasswdd.service");
$machine->succeed(
"kadmin -l add --password=admin_pw --use-defaults admin"
);
$machine->succeed(
"kadmin -l ext_keytab --keytab=admin.keytab admin"
);
$machine->succeed(
"kadmin -p admin -K admin.keytab add --password=alice_pw --use-defaults \\
alice"
);
$machine->succeed(
"kadmin -l ext_keytab --keytab=alice.keytab alice"
);
$machine->succeed("kinit -kt alice.keytab alice");
machine.succeed(
"kadmin -l add --password=admin_pw --use-defaults admin",
"kadmin -l ext_keytab --keytab=admin.keytab admin",
"kadmin -p admin -K admin.keytab add --password=alice_pw --use-defaults alice",
"kadmin -l ext_keytab --keytab=alice.keytab alice",
"kinit -kt alice.keytab alice",
)
'';
})

View file

@ -1,4 +1,4 @@
import ../make-test.nix ({pkgs, ...}: {
import ../make-test-python.nix ({pkgs, ...}: {
name = "kerberos_server-mit";
machine = { config, libs, pkgs, ...}:
{ services.kerberos_server =
@ -24,22 +24,18 @@ import ../make-test.nix ({pkgs, ...}: {
};
testScript = ''
$machine->start;
machine.succeed(
"kdb5_util create -s -r FOO.BAR -P master_key",
"systemctl restart kadmind.service kdc.service",
)
$machine->succeed(
"kdb5_util create -s -r FOO.BAR -P master_key"
);
for unit in ["kadmind", "kdc"]:
machine.wait_for_unit(f"{unit}.service")
$machine->succeed("systemctl restart kadmind.service kdc.service");
$machine->waitForUnit("kadmind.service");
$machine->waitForUnit("kdc.service");
$machine->succeed(
"kadmin.local add_principal -pw admin_pw admin"
);
$machine->succeed(
"kadmin -p admin -w admin_pw addprinc -pw alice_pw alice"
);
$machine->succeed("echo alice_pw | sudo -u alice kinit");
machine.succeed(
"kadmin.local add_principal -pw admin_pw admin",
"kadmin -p admin -w admin_pw addprinc -pw alice_pw alice",
"echo alice_pw | sudo -u alice kinit",
)
'';
})