wrapper-manager-fds/tests: init derivation for tests

This is to make checking with flakes a bit easier. Though, there are
much better ways to integrate this even with just the nix-command
experimental feature.
This commit is contained in:
Gabriel Arazas 2024-07-13 17:00:06 +08:00
parent 34c1169b92
commit 76d6dbb1d8
3 changed files with 34 additions and 8 deletions

View File

@ -1,9 +1,19 @@
{ branch ? "nixos-stable" }:
let
sources = import ../npins;
pkgs = import sources.${branch} { };
in
{ pkgs ? import sources.nixos-unstable { } }:
let
lib = import ./lib { inherit pkgs; };
in
{
lib = import ./lib { inherit pkgs; };
inherit lib;
libTestPkg =
pkgs.runCommand "wrapper-manager-fds-lib-test" {
testData = builtins.toJSON lib;
passAsFile = [ "testData" ];
nativeBuildInputs = with pkgs; [ yajsv jq ];
} ''
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
'';
}

View File

@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "wrapper-manager-fds Nix test object",
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 0,
"maxItems": 0
},
"required": true
}
}

View File

@ -3,22 +3,22 @@
lib.runTests {
testsUtilsGetBin = {
expr = self.utils.getBin [
../modules
../../lib
../../modules
];
expected = [
(lib.getBin ../modules)
(lib.getBin ../../lib)
(lib.getBin ../../modules)
];
};
testsUtilsGetLibexec = {
expr = self.utils.getLibexec [
../modules
../../lib
../../modules
];
expected = [
"${../modules}/libexec"
"${../../lib}/libexec"
"${../../modules}/libexec"
];
};