make vmTestLocal and vmTestRemote

This creates and uses a function named mkNixinateTest which takes a
buildOn argument. This expects to be either "local" or "remote". This
means we can make a test for both use cases of Nixinate. One where we
build on the remote machine, and one where we build locally and push to
the remote machine. These tests are then added to the top level of the
tests folder and are imported by the flake.nix
This commit is contained in:
matthewcroughan 2022-04-21 02:08:02 +01:00
parent 971bfe5d1f
commit 719e06be2b
2 changed files with 49 additions and 43 deletions

View file

@ -1,4 +1,5 @@
{ pkgs, makeTest, inputs }:
{
vmTest = import ./vmTest { inherit pkgs makeTest inputs; };
vmTestLocal = (import ./vmTest { inherit pkgs makeTest inputs; }).local;
vmTestRemote = (import ./vmTest { inherit pkgs makeTest inputs; }).remote;
}

View file

@ -54,8 +54,7 @@ let
};
deployScript = inputs.self.nixinate.${pkgs.hostPlatform.system} (callLocklessFlake "${exampleFlake}" { nixpkgs = inputs.nixpkgs; });
exampleSystem = (callLocklessFlake "${exampleFlake}" { nixpkgs = inputs.nixpkgs; }).nixosConfigurations.nixinatee.config.system.build.toplevel;
in
makeTest {
mkNixinateTest = buildOn: makeTest {
nodes = {
nixinatee = { ... }: {
imports = [
@ -69,7 +68,8 @@ makeTest {
virtualisation = {
additionalPaths = [
(allDrvOutputs exampleSystem)
];
]
++ pkgs.lib.optional (buildOn == "remote") exampleFlake;
};
nix = {
extraOptions =
@ -101,4 +101,9 @@ makeTest {
"curl -sSf http:/127.0.0.1/ | grep title"
)
'';
};
in
{
local = (mkNixinateTest "local");
remote = (mkNixinateTest "remote");
}