1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/tests/moosefs.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

100 lines
2.3 KiB
Nix
Raw Normal View History

2021-10-06 20:51:07 +01:00
import ./make-test-python.nix (
{ pkgs, ... }:
let
master =
{ pkgs, ... }:
{
# data base is stored in memory
# server crashes with default memory size
virtualisation.memorySize = 1024;
services.moosefs.master = {
enable = true;
openFirewall = true;
2024-11-29 14:59:23 +00:00
autoInit = true;
2021-10-06 20:51:07 +01:00
exports = [
"* / rw,alldirs,admin,maproot=0:0"
"* . rw"
];
};
};
chunkserver =
{ pkgs, ... }:
{
virtualisation.emptyDiskImages = [ 4096 ];
boot.initrd.postDeviceCommands = ''
${pkgs.e2fsprogs}/bin/mkfs.ext4 -L data /dev/vdb
'';
fileSystems = pkgs.lib.mkVMOverride {
"/data" = {
device = "/dev/disk/by-label/data";
fsType = "ext4";
};
};
services.moosefs = {
masterHost = "master";
chunkserver = {
openFirewall = true;
enable = true;
hdds = [ "~/data" ];
};
};
2021-10-06 20:51:07 +01:00
};
metalogger =
{ pkgs, ... }:
{
services.moosefs = {
masterHost = "master";
metalogger.enable = true;
};
};
client =
{ pkgs, ... }:
{
services.moosefs.client.enable = true;
};
in
{
name = "moosefs";
nodes = {
inherit master;
inherit metalogger;
chunkserver1 = chunkserver;
chunkserver2 = chunkserver;
client1 = client;
client2 = client;
};
testScript = ''
# prepare master server
master.start()
master.wait_for_unit("multi-user.target")
master.wait_for_unit("mfs-master.service")
metalogger.wait_for_unit("mfs-metalogger.service")
for chunkserver in [chunkserver1, chunkserver2]:
chunkserver.wait_for_unit("multi-user.target")
chunkserver.succeed("chown moosefs:moosefs /data")
chunkserver.succeed("systemctl restart mfs-chunkserver")
chunkserver.wait_for_unit("mfs-chunkserver.service")
for client in [client1, client2]:
client.wait_for_unit("multi-user.target")
client.succeed("mkdir /moosefs")
client.succeed("mount -t moosefs master:/ /moosefs")
client1.succeed("echo test > /moosefs/file")
client2.succeed("grep test /moosefs/file")
'';
}
)