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