Update clamav test to use local fixtures

The current version fetches clamav-db-files from gitlab,
in the master branch. This is currently broken as the files
were removed, and does not allow to ensure a fixture update
does not break the test
This commit is contained in:
Xavier Vello 2019-12-14 19:04:20 +01:00
parent 81e4a49708
commit 5fb707e61a

View file

@ -19,17 +19,15 @@ import <nixpkgs/nixos/tests/make-test.nix> {
nodes = {
server = { config, pkgs, lib, ... }:
let
clamav-db-files = lib.mapAttrs (name: value: pkgs.stdenv.mkDerivation rec {
inherit name;
src = pkgs.fetchurl {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/raw/master/tests/clamav/${name}";
sha256 = value;
};
unpackPhase = "true"; # don't try to unpack the raw .cvd files
installPhase = "cp $src $out";
}) (builtins.fromJSON (builtins.readFile ./clamav/hashes.json));
clamav-db-files = pkgs.stdenv.mkDerivation rec {
name = "clamav-db-files";
src = lib.cleanSource ./clamav;
dontUnpack = true;
installPhase = ''
mkdir $out
cp -R $src/*.cvd $out/
'';
};
in
{
imports = [
@ -58,9 +56,9 @@ import <nixpkgs/nixos/tests/make-test.nix> {
'';
script = ''
cp ${clamav-db-files."bytecode.cvd"} /var/lib/clamav/
cp ${clamav-db-files."main.cvd"} /var/lib/clamav/
cp ${clamav-db-files."daily.cvd"} /var/lib/clamav/
cp ${clamav-db-files}/main.cvd /var/lib/clamav/
cp ${clamav-db-files}/daily.cvd /var/lib/clamav/
cp ${clamav-db-files}/bytecode.cvd /var/lib/clamav/
chown clamav:clamav /var/lib/clamav/*
'';