flake.nix: run tests against pinned nixpkgs

and migrate to the new runTest, which evaluates much faster.
This commit is contained in:
Martin Weinelt 2025-05-10 02:36:21 +02:00
parent 1feca02008
commit ef1e02e555
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
7 changed files with 80 additions and 56 deletions

View file

@ -14,18 +14,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
{ pkgs ? import <nixpkgs> {}, ...}:
pkgs.nixosTest {
{
name = "external";
nodes = {
server = { config, pkgs, ... }:
server = { pkgs, ... }:
{
imports = [
../default.nix
./lib/config.nix
];
environment.systemPackages = with pkgs; [ netcat ];
virtualisation.memorySize = 1024;
services.rsyslogd = {
@ -86,7 +87,7 @@ pkgs.nixosTest {
};
};
};
client = { nodes, config, pkgs, ... }: let
client = { nodes, pkgs, ... }: let
serverIP = nodes.server.networking.primaryIPAddress;
clientIP = nodes.client.networking.primaryIPAddress;
grep-ip = pkgs.writeScriptBin "grep-ip" ''
@ -341,8 +342,7 @@ pkgs.nixosTest {
};
};
testScript = { nodes, ... }:
''
testScript = ''
start_all()
server.wait_for_unit("multi-user.target")
@ -350,7 +350,7 @@ pkgs.nixosTest {
# TODO put this blocking into the systemd units?
server.wait_until_succeeds(
"set +e; timeout 1 ${nodes.server.nixpkgs.pkgs.netcat}/bin/nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
"set +e; timeout 1 nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
)
client.execute("cp -p /etc/root/.* ~/")