1 # This tests validates the order of generated sections that may contain
3 # When a `volume` section has both `subvolume` and `target` children,
4 # `target` must go before `subvolume`. Otherwise, `target` will become
5 # a child of the last `subvolume` instead of `volume`, due to the
6 # order-sensitive config format.
8 # Issue: https://github.com/NixOS/nixpkgs/issues/195660
9 import ./make-test-python.nix ({ lib, pkgs, ... }: {
10 name = "btrbk-section-order";
11 meta.maintainers = with lib.maintainers; [ oxalica ];
13 nodes.machine = { ... }: {
14 services.btrbk.instances.local = {
17 timestamp_format = "long";
18 target."ssh://global-target/".ssh_user = "root";
20 snapshot_dir = "/volume-snapshots";
21 target."ssh://volume-target/".ssh_user = "root";
22 subvolume."@subvolume" = {
23 snapshot_dir = "/subvolume-snapshots";
24 target."ssh://subvolume-target/".ssh_user = "root";
33 machine.wait_for_unit("basic.target")
34 got = machine.succeed("cat /etc/btrbk/local.conf").strip()
36 backend btrfs-progs-sudo
39 target ssh://global-target/
42 snapshot_dir /volume-snapshots
43 target ssh://volume-target/
46 snapshot_dir /subvolume-snapshots
47 target ssh://subvolume-target/
52 diff = difflib.unified_diff(expect.splitlines(keepends=True), got.splitlines(keepends=True), fromfile="expected", tofile="got")