WIP: test refactoring

This commit is contained in:
Jaka Hudoklin 2020-04-05 21:25:34 +07:00 committed by David Arnold
parent 8ad3b90a52
commit bbc5e3d477
No known key found for this signature in database
GPG key ID: 6D6A936E69C59D08
17 changed files with 714 additions and 66 deletions

View file

@ -1,48 +1,60 @@
{ pkgs ? import <nixpkgs> {}
, lib ? pkgs.lib
, kubenix ? import ../. { inherit pkgs lib; }
, k8sVersion ? "1.21"
, nixosPath ? toString <nixpkgs/nixos>
# whether any testing error should throw an error
, throwError ? true
, e2e ? true }:
, k8sVersion ? "1.18"
, registryUrl ? throw "Registry url not defined"
, throwError ? true # whether any testing error should throw an error
, enabledTests ? null }:
with lib;
let
images = pkgs.callPackage ./images.nix {};
test = (kubenix.evalModules {
config = (kubenix.evalModules {
modules = [
kubenix.modules.testing
{
testing.name = "k8s-${k8sVersion}";
testing.throwError = throwError;
testing.e2e = e2e;
testing.tests = [
./k8s/simple.nix
./k8s/deployment.nix
./k8s/deployment-k3s.nix
# ./k8s/crd.nix # flaky
./k8s/defaults.nix
./k8s/order.nix
./k8s/submodule.nix
./k8s/imports.nix
# ./legacy/k8s.nix
# ./legacy/crd.nix
# ./legacy/modules.nix
./helm/simple.nix
# ./istio/bookinfo.nix # infinite recusion
./submodules/simple.nix
./submodules/defaults.nix
./submodules/versioning.nix
./submodules/exports.nix
./submodules/passthru.nix
];
testing.args = {
inherit images k8sVersion;
testing = {
name = "kubenix-${k8sVersion}";
throwError = throwError;
enabledTests = enabledTests;
tests = [
./k8s/simple.nix
./k8s/deployment.nix
./k8s/deployment-k3s.nix
# ./k8s/crd.nix # flaky
./k8s/defaults.nix
./k8s/order.nix
./k8s/submodule.nix
./k8s/imports.nix
#./legacy/k8s.nix
#./legacy/crd.nix
#./legacy/modules.nix
./helm/simple.nix
# ./istio/bookinfo.nix # infinite recursion
./submodules/simple.nix
./submodules/defaults.nix
./submodules/versioning.nix
./submodules/exports.nix
./submodules/passthru.nix
];
args = {
inherit images;
};
docker.registryUrl = registryUrl;
defaults = [
{
features = ["k8s"];
default = {
kubernetes.version = k8sVersion;
};
}
];
};
}
];
@ -53,4 +65,4 @@ let
inherit kubenix nixosPath;
};
}).config;
in pkgs.recurseIntoAttrs test.testing
in pkgs.recurseIntoAttrs config.testing