CLI deployment test: same
This commit is contained in:
parent
7cf43c4041
commit
2adca067c9
5 changed files with 119 additions and 80 deletions
11
deployment/check/cli/constants.nix
Normal file
11
deployment/check/cli/constants.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
targetMachines = [
|
||||||
|
"garage"
|
||||||
|
"mastodon"
|
||||||
|
"peertube"
|
||||||
|
"pixelfed"
|
||||||
|
];
|
||||||
|
pathToRoot = ../../..;
|
||||||
|
pathFromRoot = ./.;
|
||||||
|
enableAcme = true;
|
||||||
|
}
|
19
deployment/check/cli/default.nix
Normal file
19
deployment/check/cli/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
runNixOSTest,
|
||||||
|
inputs,
|
||||||
|
sources,
|
||||||
|
}:
|
||||||
|
|
||||||
|
runNixOSTest {
|
||||||
|
imports = [
|
||||||
|
../common/nixosTest.nix
|
||||||
|
./nixosTest.nix
|
||||||
|
];
|
||||||
|
_module.args = { inherit inputs sources; };
|
||||||
|
inherit (import ./constants.nix)
|
||||||
|
targetMachines
|
||||||
|
pathToRoot
|
||||||
|
pathFromRoot
|
||||||
|
enableAcme
|
||||||
|
;
|
||||||
|
}
|
59
deployment/check/cli/deployments.nix
Normal file
59
deployment/check/cli/deployments.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
sources,
|
||||||
|
lib,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (builtins) fromJSON readFile listToAttrs;
|
||||||
|
inherit (import ./constants.nix)
|
||||||
|
targetMachines
|
||||||
|
pathToRoot
|
||||||
|
pathFromRoot
|
||||||
|
enableAcme
|
||||||
|
;
|
||||||
|
|
||||||
|
makeTargetResource = nodeName: {
|
||||||
|
imports = [ ../common/targetResource.nix ];
|
||||||
|
_module.args = { inherit inputs sources; };
|
||||||
|
inherit
|
||||||
|
nodeName
|
||||||
|
pathToRoot
|
||||||
|
pathFromRoot
|
||||||
|
enableAcme
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
## The deployment function - what we are here to test!
|
||||||
|
##
|
||||||
|
## TODO: Modularise `deployment/default.nix` to get rid of the nested
|
||||||
|
## function calls.
|
||||||
|
makeTestDeployment =
|
||||||
|
args:
|
||||||
|
(import ../..)
|
||||||
|
{
|
||||||
|
inherit lib;
|
||||||
|
inherit (inputs) nixops4 nixops4-nixos;
|
||||||
|
fediversity = import ../../../services/fediversity;
|
||||||
|
}
|
||||||
|
(listToAttrs (
|
||||||
|
map (nodeName: {
|
||||||
|
name = "${nodeName}ConfigurationResource";
|
||||||
|
value = makeTargetResource nodeName;
|
||||||
|
}) targetMachines
|
||||||
|
))
|
||||||
|
(fromJSON (readFile ../../configuration.sample.json) // args);
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
check-deployment-cli-nothing = makeTestDeployment { };
|
||||||
|
|
||||||
|
check-deployment-cli-mastodon-pixelfed = makeTestDeployment {
|
||||||
|
mastodon.enable = true;
|
||||||
|
pixelfed.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
check-deployment-cli-peertube = makeTestDeployment {
|
||||||
|
peertube.enable = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,90 +1,14 @@
|
||||||
{
|
{ inputs, sources, ... }:
|
||||||
self,
|
|
||||||
inputs,
|
|
||||||
lib,
|
|
||||||
sources,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (builtins) fromJSON readFile listToAttrs;
|
|
||||||
|
|
||||||
targetMachines = [
|
|
||||||
"garage"
|
|
||||||
"mastodon"
|
|
||||||
"peertube"
|
|
||||||
"pixelfed"
|
|
||||||
];
|
|
||||||
pathToRoot = /. + (builtins.unsafeDiscardStringContext self);
|
|
||||||
pathFromRoot = ./.;
|
|
||||||
enableAcme = true;
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
_class = "flake";
|
_class = "flake";
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
checks.deployment-cli = pkgs.testers.runNixOSTest {
|
checks.deployment-cli = import ./. {
|
||||||
imports = [
|
inherit (pkgs.testers) runNixOSTest;
|
||||||
../common/nixosTest.nix
|
inherit inputs sources;
|
||||||
./nixosTest.nix
|
|
||||||
];
|
|
||||||
_module.args = { inherit inputs sources; };
|
|
||||||
inherit
|
|
||||||
targetMachines
|
|
||||||
pathToRoot
|
|
||||||
pathFromRoot
|
|
||||||
enableAcme
|
|
||||||
;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixops4Deployments =
|
|
||||||
let
|
|
||||||
makeTargetResource = nodeName: {
|
|
||||||
imports = [ ../common/targetResource.nix ];
|
|
||||||
_module.args = { inherit inputs sources; };
|
|
||||||
inherit
|
|
||||||
nodeName
|
|
||||||
pathToRoot
|
|
||||||
pathFromRoot
|
|
||||||
enableAcme
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
## The deployment function - what we are here to test!
|
|
||||||
##
|
|
||||||
## TODO: Modularise `deployment/default.nix` to get rid of the nested
|
|
||||||
## function calls.
|
|
||||||
makeTestDeployment =
|
|
||||||
args:
|
|
||||||
(import ../..)
|
|
||||||
{
|
|
||||||
inherit lib;
|
|
||||||
inherit (inputs) nixops4 nixops4-nixos;
|
|
||||||
fediversity = import ../../../services/fediversity;
|
|
||||||
}
|
|
||||||
(listToAttrs (
|
|
||||||
map (nodeName: {
|
|
||||||
name = "${nodeName}ConfigurationResource";
|
|
||||||
value = makeTargetResource nodeName;
|
|
||||||
}) targetMachines
|
|
||||||
))
|
|
||||||
(fromJSON (readFile ../../configuration.sample.json) // args);
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
check-deployment-cli-nothing = makeTestDeployment { };
|
|
||||||
|
|
||||||
check-deployment-cli-mastodon-pixelfed = makeTestDeployment {
|
|
||||||
mastodon.enable = true;
|
|
||||||
pixelfed.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
check-deployment-cli-peertube = makeTestDeployment {
|
|
||||||
peertube.enable = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
26
deployment/check/cli/flake-under-test.nix
Normal file
26
deployment/check/cli/flake-under-test.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixops4.follows = "nixops4-nixos/nixops4";
|
||||||
|
nixops4-nixos.url = "github:nixops4/nixops4-nixos";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
import ./mkFlake.nix inputs (
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
sources,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.nixops4.modules.flake.default
|
||||||
|
];
|
||||||
|
|
||||||
|
nixops4Deployments = import ./deployment/check/cli/deployments.nix {
|
||||||
|
inherit inputs sources lib;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue