mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
parent
0617636562
commit
6a1662f754
2 changed files with 65 additions and 67 deletions
|
@ -229,7 +229,7 @@ in
|
||||||
bazarr = runTest ./bazarr.nix;
|
bazarr = runTest ./bazarr.nix;
|
||||||
bcachefs = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./bcachefs.nix;
|
bcachefs = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./bcachefs.nix;
|
||||||
beanstalkd = runTest ./beanstalkd.nix;
|
beanstalkd = runTest ./beanstalkd.nix;
|
||||||
bees = handleTest ./bees.nix { };
|
bees = runTest ./bees.nix;
|
||||||
benchexec = handleTest ./benchexec.nix { };
|
benchexec = handleTest ./benchexec.nix { };
|
||||||
binary-cache = runTest {
|
binary-cache = runTest {
|
||||||
imports = [ ./binary-cache.nix ];
|
imports = [ ./binary-cache.nix ];
|
||||||
|
|
|
@ -1,74 +1,72 @@
|
||||||
import ./make-test-python.nix (
|
{ lib, pkgs, ... }:
|
||||||
{ lib, pkgs, ... }:
|
{
|
||||||
{
|
name = "bees";
|
||||||
name = "bees";
|
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
boot.initrd.postDeviceCommands = ''
|
boot.initrd.postDeviceCommands = ''
|
||||||
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux1 /dev/vdb
|
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux1 /dev/vdb
|
||||||
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux2 /dev/vdc
|
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux2 /dev/vdc
|
||||||
'';
|
'';
|
||||||
virtualisation.emptyDiskImages = [
|
virtualisation.emptyDiskImages = [
|
||||||
4096
|
4096
|
||||||
4096
|
4096
|
||||||
];
|
];
|
||||||
virtualisation.fileSystems = {
|
virtualisation.fileSystems = {
|
||||||
"/aux1" = {
|
"/aux1" = {
|
||||||
# filesystem configured to be deduplicated
|
# filesystem configured to be deduplicated
|
||||||
device = "/dev/disk/by-label/aux1";
|
device = "/dev/disk/by-label/aux1";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
};
|
|
||||||
"/aux2" = {
|
|
||||||
# filesystem not configured to be deduplicated
|
|
||||||
device = "/dev/disk/by-label/aux2";
|
|
||||||
fsType = "btrfs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
services.beesd.filesystems = {
|
"/aux2" = {
|
||||||
aux1 = {
|
# filesystem not configured to be deduplicated
|
||||||
spec = "LABEL=aux1";
|
device = "/dev/disk/by-label/aux2";
|
||||||
hashTableSizeMB = 16;
|
fsType = "btrfs";
|
||||||
verbosity = "debug";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
services.beesd.filesystems = {
|
||||||
|
aux1 = {
|
||||||
|
spec = "LABEL=aux1";
|
||||||
|
hashTableSizeMB = 16;
|
||||||
|
verbosity = "debug";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript =
|
testScript =
|
||||||
let
|
let
|
||||||
someContentIsShared =
|
someContentIsShared =
|
||||||
loc:
|
loc:
|
||||||
pkgs.writeShellScript "some-content-is-shared" ''
|
pkgs.writeShellScript "some-content-is-shared" ''
|
||||||
[[ $(btrfs fi du -s --raw ${lib.escapeShellArg loc}/dedup-me-{1,2} | awk 'BEGIN { count=0; } NR>1 && $3 == 0 { count++ } END { print count }') -eq 0 ]]
|
[[ $(btrfs fi du -s --raw ${lib.escapeShellArg loc}/dedup-me-{1,2} | awk 'BEGIN { count=0; } NR>1 && $3 == 0 { count++ } END { print count }') -eq 0 ]]
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
# shut down the instance started by systemd at boot, so we can test our test procedure
|
# shut down the instance started by systemd at boot, so we can test our test procedure
|
||||||
machine.succeed("systemctl stop beesd@aux1.service")
|
machine.succeed("systemctl stop beesd@aux1.service")
|
||||||
|
|
||||||
machine.succeed(
|
machine.succeed(
|
||||||
"dd if=/dev/urandom of=/aux1/dedup-me-1 bs=1M count=8",
|
"dd if=/dev/urandom of=/aux1/dedup-me-1 bs=1M count=8",
|
||||||
"cp --reflink=never /aux1/dedup-me-1 /aux1/dedup-me-2",
|
"cp --reflink=never /aux1/dedup-me-1 /aux1/dedup-me-2",
|
||||||
"cp --reflink=never /aux1/* /aux2/",
|
"cp --reflink=never /aux1/* /aux2/",
|
||||||
"sync",
|
"sync",
|
||||||
)
|
)
|
||||||
machine.fail(
|
machine.fail(
|
||||||
"${someContentIsShared "/aux1"}",
|
"${someContentIsShared "/aux1"}",
|
||||||
"${someContentIsShared "/aux2"}",
|
"${someContentIsShared "/aux2"}",
|
||||||
)
|
)
|
||||||
machine.succeed("systemctl start beesd@aux1.service")
|
machine.succeed("systemctl start beesd@aux1.service")
|
||||||
|
|
||||||
# assert that "Set Shared" column is nonzero
|
# assert that "Set Shared" column is nonzero
|
||||||
machine.wait_until_succeeds(
|
machine.wait_until_succeeds(
|
||||||
"${someContentIsShared "/aux1"}",
|
"${someContentIsShared "/aux1"}",
|
||||||
)
|
)
|
||||||
machine.fail("${someContentIsShared "/aux2"}")
|
machine.fail("${someContentIsShared "/aux2"}")
|
||||||
|
|
||||||
# assert that 16MB hash table size requested was honored
|
# assert that 16MB hash table size requested was honored
|
||||||
machine.succeed(
|
machine.succeed(
|
||||||
"[[ $(stat -c %s /aux1/.beeshome/beeshash.dat) = $(( 16 * 1024 * 1024)) ]]"
|
"[[ $(stat -c %s /aux1/.beeshome/beeshash.dat) = $(( 16 * 1024 * 1024)) ]]"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue