checks/ipfs-cluster-upgrade: init

This commit is contained in:
Max Headroom 2024-06-05 19:27:11 +02:00
parent 890622750c
commit 82278da2e5
2 changed files with 56 additions and 0 deletions

View file

@ -1,5 +1,11 @@
{ config, lib, self, ... }:
let
timeMachine = {
preUnstable = config.lib.timeTravel "637f048ee36d5052e2e7938bf9039e418accde66";
};
in
{
perSystem = { filters, pkgs, self', system, ... }: {
checks = lib.mkIf (system == "x86_64-linux") {
@ -14,6 +20,11 @@
inherit (config) cluster;
};
ipfs-cluster-upgrade = pkgs.callPackage ./ipfs-cluster-upgrade.nix {
inherit (self) nixosModules;
previous = timeMachine.preUnstable;
};
jellyfin-stateless = pkgs.callPackage ./jellyfin-stateless.nix {
inherit (self'.packages) jellyfin;
inherit (config) cluster;

View file

@ -0,0 +1,45 @@
{ testers, nixosModules, lib, ipfs-cluster, previous, system }:
testers.runNixOSTest {
name = "ipfs-cluster-upgrade";
extraBaseModules = {
imports = [
nixosModules.ipfs
nixosModules.ipfs-cluster
nixosModules.systemd-extras
];
services.ipfs = {
enable = true;
apiAddress = "/ip4/127.0.0.1/tcp/5001";
};
services.ipfs-cluster = {
enable = true;
openSwarmPort = true;
consensus = "crdt";
package = previous.packages.${system}.ipfs-cluster;
};
specialisation.upgrade = {
inheritParentConfig = true;
configuration = {
services.ipfs-cluster.package = lib.mkForce ipfs-cluster;
};
};
};
nodes.machine = {};
testScript = /*python*/ ''
machine.wait_for_unit("ipfs.service")
machine.wait_for_unit("ipfs-cluster.service")
machine.succeed("ipfs-cluster-ctl add -r -n TestPin123 /var/empty")
machine.succeed("systemctl stop ipfs-cluster.service")
machine.succeed("/run/current-system/specialisation/upgrade/bin/switch-to-configuration test")
machine.wait_for_unit("ipfs-cluster.service")
machine.succeed("systemctl is-active ipfs-cluster.service")
machine.succeed("ipfs-cluster-ctl pin ls | grep TestPin123")
'';
}