From b36f43e47736dee67fd46f88afb04484fbc645bf Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Tue, 11 Jan 2022 09:19:13 -0500 Subject: [PATCH] Put the testing library into "ourpkgs" --- nixos/lib/default.nix | 6 ++++++ nixos/lib/testing.nix | 2 +- nixos/pkgs/default.nix | 2 ++ nixos/tests/private-storage.nix | 4 ++-- nixos/tests/tahoe.nix | 5 +++-- 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 nixos/lib/default.nix diff --git a/nixos/lib/default.nix b/nixos/lib/default.nix new file mode 100644 index 00000000..3ebaf60b --- /dev/null +++ b/nixos/lib/default.nix @@ -0,0 +1,6 @@ +{ callPackage }: +{ + /* A library of tools useful for writing tests with Nix. + */ + testing = callPackage ./testing.nix { }; +} diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index de68dc1f..d89717a0 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -1,5 +1,5 @@ +{ ...}: { - /* Returns a string that runs tests from the Python code at the given path. The Python code is loaded using *execfile* and the *test* global it diff --git a/nixos/pkgs/default.nix b/nixos/pkgs/default.nix index bfc30b36..435095f7 100644 --- a/nixos/pkgs/default.nix +++ b/nixos/pkgs/default.nix @@ -5,6 +5,8 @@ # pkgs.callPackage ./nixos/pkgs {buildPlatform, hostPlatform, callPackage}: { + lib = callPackage ../lib {}; + leasereport = callPackage ./leasereport {}; # `privatestorage` is a derivation with a good Tahoe+ZKAP environment # that is exposed by ZKAPAuthorizer. diff --git a/nixos/tests/private-storage.nix b/nixos/tests/private-storage.nix index d6fdfaf9..eaff1ed5 100644 --- a/nixos/tests/private-storage.nix +++ b/nixos/tests/private-storage.nix @@ -1,6 +1,6 @@ { pkgs }: let - makeTestScript = (import ../lib/testing.nix).makeTestScript; + ourpkgs = pkgs.callPackage ../pkgs { }; sshPrivateKey = ./probeuser_ed25519; sshPublicKey = ./probeuser_ed25519.pub; @@ -154,7 +154,7 @@ in { }; # Test the machines with a Python program. - testScript = makeTestScript { + testScript = ourpkgs.lib.testing.makeTestScript { testpath = ./test_privatestorage.py; kwargs = { inherit sshPrivateKey pemFile introducerPort introducerFURL issuerURL ristrettoPublicKey voucher; diff --git a/nixos/tests/tahoe.nix b/nixos/tests/tahoe.nix index da6c5ee1..a007e65e 100644 --- a/nixos/tests/tahoe.nix +++ b/nixos/tests/tahoe.nix @@ -1,5 +1,6 @@ +{ pkgs }: let - makeTestScript = (import ../lib/testing.nix).makeTestScript; + ourpkgs = pkgs.callPackage ../pkgs { }; in { nodes = { @@ -25,7 +26,7 @@ in }; }; }; - testScript = makeTestScript { + testScript = ourpkgs.lib.testing.makeTestScript { testpath = ./test_tahoe.py; }; } -- GitLab