compat nixpkgs and change to testing-python.nix

This commit is contained in:
GTrunSec 2021-04-03 22:37:13 -07:00
parent 842c903201
commit 8f0e518bc0
No known key found for this signature in database
GPG key ID: 2368FAFA4ABDD2A0
3 changed files with 36 additions and 9 deletions

17
lib/compat.nix Normal file
View file

@ -0,0 +1,17 @@
let
inherit (builtins)
fetchTarball
fromJSON
readFile
;
lockfile = fromJSON (readFile ../flake.lock);
in
input:
let
locked = lockfile.nodes."${input}".locked;
inherit (locked) rev narHash owner repo;
in
fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
}

View file

@ -7,7 +7,7 @@ let
toJSONFile = content: builtins.toFile "json" (builtins.toJSON content);
nixosTesting = import "${nixosPath}/lib/testing.nix" {
nixosTesting = import "${nixosPath}/lib/testing-python.nix" {
inherit pkgs;
system = "x86_64-linux";
};

View file

@ -1,5 +1,12 @@
{ pkgs ? import <nixpkgs> {}, nixosPath ? toString <nixpkgs/nixos>, lib ? pkgs.lib
, e2e ? true, throwError ? true }:
let
fetch = import ./lib/compat.nix;
in
{ pkgs ? import (fetch "nixpkgs") { }
, nixosPath ? toString (fetch "nixpkgs") + "/nixos"
, lib ? pkgs.lib
, e2e ? true
, throwError ? true
}:
with lib;
@ -23,7 +30,8 @@ let
runK8STests = k8sVersion: import ./tests {
inherit pkgs lib kubenix k8sVersion e2e throwError nixosPath;
};
in rec {
in
rec {
generate.k8s = pkgs.linkFarm "k8s-generated.nix" [
{
name = "v1.8.nix";
@ -130,10 +138,12 @@ in rec {
k8s-1_18 = runK8STests "1.18";
};
test-results = pkgs.recurseIntoAttrs (mapAttrs (_: t: pkgs.recurseIntoAttrs {
test-results = pkgs.recurseIntoAttrs (mapAttrs
(_: t: pkgs.recurseIntoAttrs {
results = pkgs.recurseIntoAttrs t.results;
result = t.result;
}) tests);
})
tests);
test-check =
if !(all (test: test.success) (attrValues tests))