Skip to content

Commit

Permalink
tests/plugins-by-name: test that required files exist
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Sep 9, 2024
1 parent 4370304 commit f8d23cf
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/plugins-by-name.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,45 @@ linkFarmFromDrvs "plugins-by-name" [
''
)

# Check default.nix files exist for each directory
(runCommandNoCCLocal "default-nix-exists"
{
__structuredAttrs = true;
missingPlugins = builtins.filter (
name: !(builtins.pathExists "${by-name}/${name}/default.nix")
) children.directory;
missingTests = builtins.filter (
name: !(builtins.pathExists "${./test-sources/plugins/by-name}/${name}/default.nix")
) children.directory;
}
''
declare -i errs=0
if (( ''${#missingPlugins[@]} > 0 )); then
((++errs))
echo "The following (''${#missingPlugins[@]}) directories do not have a default.nix file:"
for name in "''${missingPlugins[@]}"; do
echo " - plugins/by-name/$name"
done
echo
fi
if (( ''${#missingTests[@]} > 0 )); then
((++errs))
echo "The following (''${#missingTests[@]}) test files do not exist:"
for name in "''${missingTests[@]}"; do
echo " - tests/test-sources/plugins/by-name/$name/default.nix"
done
echo
fi
if (( $errs > 0 )); then
exit $errs
fi
touch $out
''
)

# Ensures all plugin enable options are declared in a directory matching the plugin name
(runCommandNoCCLocal "mismatched-plugin-names"
{
Expand Down

0 comments on commit f8d23cf

Please sign in to comment.