Merge pull request #259460 from K900/test-eval-fixes

treewide: test eval fixes
This commit is contained in:
K900 2023-10-07 07:36:46 +03:00 committed by GitHub
commit b7a3aaae38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 35 deletions

View File

@ -30,13 +30,15 @@ let
})
({ options, ... }: {
key = "nodes.nix-pkgs";
config = mkIf (!options.nixpkgs.pkgs.isDefined) {
# Ensure we do not use aliases. Ideally this is only set
# when the test framework is used by Nixpkgs NixOS tests.
nixpkgs.config.allowAliases = false;
# TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates.
nixpkgs.system = hostPkgs.stdenv.hostPlatform.system;
};
config = optionalAttrs (!config.node.pkgsReadOnly) (
mkIf (!options.nixpkgs.pkgs.isDefined) {
# Ensure we do not use aliases. Ideally this is only set
# when the test framework is used by Nixpkgs NixOS tests.
nixpkgs.config.allowAliases = false;
# TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates.
nixpkgs.system = hostPkgs.stdenv.hostPlatform.system;
}
);
})
testModuleArgs.config.extraBaseModules
];

View File

@ -154,5 +154,5 @@ in
};
};
meta.maintainers = with lib.maintainers; [ erictapen bbenno joscha ];
meta.maintainers = with lib.maintainers; [ erictapen bbenno ];
}

View File

@ -192,7 +192,7 @@ in {
# orangefs daemon will run as user
users.users.orangefs = {
isSystemUser = true;
group = "orangfs";
group = "orangefs";
};
users.groups.orangefs = {};

View File

@ -331,7 +331,6 @@ in {
graylog = handleTest ./graylog.nix {};
grocy = handleTest ./grocy.nix {};
grub = handleTest ./grub.nix {};
guacamole-client = handleTest ./guacamole-client.nix {};
guacamole-server = handleTest ./guacamole-server.nix {};
gvisor = handleTest ./gvisor.nix {};
hadoop = import ./hadoop { inherit handleTestOn; package=pkgs.hadoop; };

View File

@ -14,8 +14,8 @@ import ./make-test-python.nix
profiles.user.databases = [
{
settings = {
"test/not/locked" = mkInt32 1;
"test/is/locked" = "locked";
"test/not".locked = mkInt32 1;
"test/is".locked = "locked";
};
locks = [
"/test/is/locked"

View File

@ -28,7 +28,7 @@ import ./make-test-python.nix ({ pkgs, ... } : {
};
};
boot.extraModulePackages =
optional (versionOlder config.boot.kernelPackages.kernel.version "5.6")
pkgs.lib.optional (pkgs.lib.versionOlder config.boot.kernelPackages.kernel.version "5.6")
config.boot.kernelPackages.wireguard;
boot.kernelModules = [ "wireguard" ];
};

View File

@ -8,7 +8,7 @@ in
meta.maintainers = [ lib.maintainers.ratsclub ];
nodes = {
server = { config, pkgs }: {
server = { config, pkgs, ... }: {
services.legit = {
enable = true;
settings = {

View File

@ -44,14 +44,22 @@ import ./make-test-python.nix ({ pkgs, ...} : {
};
services.grafana = {
enable = true;
security = {
adminUser = "admin";
adminPassword = "admin";
};
addr = "localhost";
port = 3000;
extraOptions = {
DATABASE_URL = "sqlite3:///var/lib/grafana/data/grafana.db?cache=private&mode=rwc&_journal_mode=WAL";
settings = {
security = {
admin_user = "admin";
admin_password = "admin";
};
server = {
http_addr = "localhost";
http_port = 3000;
};
database = {
type = "sqlite3";
path = "/var/lib/grafana/data/grafana.db";
wal = true;
};
};
};
users.users.foo = {

View File

@ -8,8 +8,8 @@ let
};
};
lxd-image-metadata = lxd-image.lxdMeta.${pkgs.stdenv.hostPlatform.system};
lxd-image-rootfs = lxd-image.lxdImage.${pkgs.stdenv.hostPlatform.system};
lxd-image-metadata = lxd-image.lxdContainerMeta.${pkgs.stdenv.hostPlatform.system};
lxd-image-rootfs = lxd-image.lxdContainerImage.${pkgs.stdenv.hostPlatform.system};
in {
name = "lxd-image-server";

View File

@ -27,7 +27,7 @@ import ./make-test-python.nix ({ pkgs, ... }:
in {
name = "mongodb";
meta = with pkgs.lib.maintainers; {
maintainers = [ bluescreen303 offline cstrahan rvl phile314 ];
maintainers = [ bluescreen303 offline rvl phile314 ];
};
nodes = {

View File

@ -36,7 +36,7 @@ in
machine.succeed("echo 'SELECT address FROM etc_hosts LIMIT 1;' | osqueryi | tee /dev/console | grep -q '127.0.0.1'")
# osquery binaries respect configuration from the Nix config option.
machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"utc\";' | osqueryi | tee /dev/console | grep -q ${boolToString utc}")
machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"utc\";' | osqueryi | tee /dev/console | grep -q ${lib.boolToString utc}")
# osquery binaries respect configuration from the Nix flags option.
machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"config_refresh\";' | osqueryi | tee /dev/console | grep -q ${config_refresh}")

View File

@ -17,7 +17,7 @@ let
# Returns an attributeset of users who are not system users.
normalUsers = config:
filterAttrs (name: user: user.isNormalUser) config.users.users;
lib.filterAttrs (name: user: user.isNormalUser) config.users.users;
# Returns true if a user is a member of the given group
isMemberOf =
@ -26,7 +26,7 @@ let
groupName:
# users.users attrset
user:
any (x: x == user.name) config.users.groups.${groupName}.members;
lib.any (x: x == user.name) config.users.groups.${groupName}.members;
# Generates a valid SFTPGo user configuration for a given user
# Will be converted to JSON and loaded on application startup.
@ -52,7 +52,7 @@ let
# inside the dataprovider they will be automatically created.
# You have to create the folder on the filesystem yourself
virtual_folders =
lib.optional (lib.isMemberOf config sharedFolderName user) {
lib.optional (isMemberOf config sharedFolderName user) {
name = sharedFolderName;
mapped_path = "${config.services.sftpgo.dataDir}/${sharedFolderName}";
virtual_path = "/${sharedFolderName}";
@ -63,7 +63,7 @@ let
lib.recursiveUpdate {
"/" = [ "list" ]; # read-only top level directory
"/private" = [ "*" ]; # private subdirectory, not shared with others
} (lib.optionalAttrs (lib.isMemberOf config "shared" user) {
} (lib.optionalAttrs (isMemberOf config "shared" user) {
"/shared" = [ "*" ];
});
@ -89,7 +89,7 @@ let
# of users and folders to import to SFTPGo.
loadDataJson = config: pkgs.writeText "users-and-folders.json" (builtins.toJSON {
users =
lib.mapAttrsToList (name: user: lib.generateUserAttrSet config user) (normalUsers config);
lib.mapAttrsToList (name: user: generateUserAttrSet config user) (normalUsers config);
folders = [
{
@ -144,7 +144,7 @@ in
{
name = "sftpgo";
meta.maintainers = with maintainers; [ yayayayaka ];
meta.maintainers = with lib.maintainers; [ yayayayaka ];
nodes = {
server = { nodes, ... }: {
@ -228,7 +228,7 @@ in
# Created shared folder directories
"d ${statePath}/${sharedFolderName} 2770 ${sftpgoUser} ${sharedFolderName} -"
]
++ mapAttrsToList (name: user:
++ lib.mapAttrsToList (name: user:
# Create private user directories
''
d ${statePath}/users/${user.name} 0700 ${sftpgoUser} ${sftpgoGroup} -
@ -273,12 +273,12 @@ in
networking.firewall.allowedTCPPorts = [ 22 80 ];
services.sftpgo = {
settings = {
sftpd.bindings = mkForce [{
sftpd.bindings = lib.mkForce [{
address = "";
port = 22;
}];
httpd.bindings = mkForce [{
httpd.bindings = lib.mkForce [{
address = "";
port = 80;
}];

View File

@ -43,6 +43,10 @@ import ./make-test-python.nix ({ pkgs, ... }: {
mv $GOPATH/tracee-integration $out/bin/
'';
doInstallCheck = false;
meta = oa.meta // {
outputsToInstall = [];
};
}))
];
};