forked from Fediversity/Fediversity
closes #93. note that this includes classes: - `nixos` - `nixosTest` - `nixops4Resource` - `nixops4Deployment` .. and my (made-up, as per the [docs](https://ryantm.github.io/nixpkgs/module-system/module-system/#module-system-lib-evalModules-param-class)): - `nix-unit` - `package` .. while i did not manage to cover: - service tests, given `pkgs.nixosTest` seemed to not actually like `_class = "nixosTest"` (?!) ... nor #93's mentioned destructured arguments for that matter, as per Fediversity/Fediversity#93 (comment) - let me know if that is still desired as well. Reviewed-on: Fediversity/Fediversity#398 Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Kiara Grouwstra <kiara@procolix.eu> Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
43 lines
943 B
Nix
43 lines
943 B
Nix
{ inputs, ... }:
|
|
|
|
{
|
|
_class = "nixosTest";
|
|
|
|
name = "deployment-basic";
|
|
|
|
nodes.deployer =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = [
|
|
inputs.nixops4.packages.${pkgs.system}.default
|
|
];
|
|
|
|
# FIXME: sad times
|
|
system.extraDependencies = with pkgs; [
|
|
jq
|
|
jq.inputDerivation
|
|
];
|
|
|
|
system.extraDependenciesFromModule =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = with pkgs; [
|
|
hello
|
|
cowsay
|
|
];
|
|
};
|
|
};
|
|
|
|
extraTestScript = ''
|
|
with subtest("Check the status before deployment"):
|
|
hello.fail("hello 1>&2")
|
|
cowsay.fail("cowsay 1>&2")
|
|
|
|
with subtest("Run the deployment"):
|
|
deployer.succeed("nixops4 apply check-deployment-basic --show-trace --no-interactive 1>&2")
|
|
|
|
with subtest("Check the deployment"):
|
|
hello.succeed("hello 1>&2")
|
|
cowsay.succeed("cowsay hi 1>&2")
|
|
'';
|
|
}
|