blob: a48882544508ca7594eaacbaa968adb76d229ed3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{
name,
pkgs,
testBase,
system,
...
}:
with import ../../lib/testing-python.nix { inherit system pkgs; };
runTest (
{ lib, ... }:
{
inherit name;
meta.maintainers = lib.teams.nextcloud.members;
imports = [ testBase ];
nodes.nextcloud = { pkgs, ... }: {
# Make sure that inside our tmpfs mount an actual directory for Nextcloud exists.
boot.initrd.systemd.tmpfiles.settings."nextcloud"."/sysroot/mnt/nextcloud".d = { };
boot.initrd.systemd.mounts = [
# Create a mocked /mnt/nextcloud. Only a tmpfs here, but in reality this could e.g.
# be the mount of a larger disk.
{
unitConfig.DefaultDependencies = "no";
conflicts = [ "umount.target" ];
wantedBy = [ "initrd.target" ];
before = [ "systemd-tmpfiles-setup-sysroot.service" ];
options = "x-initrd.mount";
where = "/sysroot/mnt";
what = "tmpfs";
type = "tmpfs";
}
# Bind some directory to /var/lib/nextcloud, the place that the Nextcloud module expects
# by default.
{
conflicts = [ "umount.target" ];
wantedBy = [ "initrd.target" ];
before = [ "systemd-tmpfiles-setup-sysroot.service" ];
options = "x-initrd.mount,bind";
where = "/sysroot/var/lib/nextcloud";
what = "/sysroot/mnt/nextcloud";
type = "none";
}
];
environment.systemPackages = [
pkgs.util-linux
];
services.nextcloud = {
config.dbtype = "sqlite";
};
};
test-helpers.init = ''
import json
mnts = json.loads(nextcloud.succeed("findmnt /var/lib/nextcloud -J"))["filesystems"]
t.assertEqual(1, len(mnts))
mnt = mnts[0]
t.assertEqual("tmpfs[/nextcloud]", mnt["source"])
t.assertEqual("/var/lib/nextcloud", mnt["target"])
'';
test-helpers.extraTests = ''
nextcloud.succeed("test -d /mnt/nextcloud/data/root")
'';
}
)
|