mob next [ci-skip] [ci skip] [skip ci]
lastFile:tests/tests/think-gtcm.nix
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
./routers
|
||||
./inventories
|
||||
./overlays
|
||||
./tests
|
||||
./modules/clan/flake-module.nix
|
||||
./modules/nixos/flake-module.nix
|
||||
];
|
||||
|
||||
@@ -220,7 +220,7 @@ in
|
||||
virtualHosts."${cfg.domain}" = {
|
||||
root = "${cfg.stateDir}/public";
|
||||
locations."~ \\.php$".extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.flarum.socket};
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.think-greaterchiangmai.socket};
|
||||
fastcgi_index site.php;
|
||||
'';
|
||||
extraConfig = ''
|
||||
17
tests/default.nix
Normal file
17
tests/default.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ pkgs, self', ... }:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
checkArgs = {
|
||||
inherit pkgs;
|
||||
self = self';
|
||||
};
|
||||
in
|
||||
{
|
||||
think-gtcm = import ./tests/think-gtcm.nix checkArgs;
|
||||
};
|
||||
};
|
||||
}
|
||||
18
tests/lib.nix
Normal file
18
tests/lib.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
test:
|
||||
# These arguments are provided by `flake.nix` on import, see checkArgs
|
||||
{ pkgs, self }:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
# this imports the nixos library that contains our testing framework
|
||||
nixos-lib = import (pkgs.path + "/nixos/lib") { };
|
||||
in
|
||||
(nixos-lib.runTest {
|
||||
hostPkgs = pkgs;
|
||||
# This speeds up the evaluation by skipping evaluating documentation (optional)
|
||||
defaults.documentation.enable = lib.mkDefault false;
|
||||
# This makes `self` available in the NixOS configuration of our virtual machines.
|
||||
# This is useful for referencing modules or packages from your own flake
|
||||
# as well as importing from other flakes.
|
||||
node.specialArgs = { inherit self; };
|
||||
imports = [ test ];
|
||||
}).config.result
|
||||
22
tests/tests/think-gtcm.nix
Normal file
22
tests/tests/think-gtcm.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
(import ../lib.nix) {
|
||||
name = "think-gtcm";
|
||||
nodes = {
|
||||
# `self` here is set by using specialArgs in `lib.nix`
|
||||
node1 =
|
||||
{ self, pkgs, ... }:
|
||||
{
|
||||
imports = [ ];
|
||||
services.think-greaterchiangmai = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
# This is the test code that will check if our service is running correctly:
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
node1.wait_for_unit("think-greaterchiangmai")
|
||||
node1.wait_for_open_port(80)
|
||||
output = node1.succeed("curl localhost")
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user