fix tests, do not test k8s 1.8 to 1.10 anymore

This commit is contained in:
Jaka Hudoklin 2020-04-04 18:44:43 +07:00
parent 3534f5fc61
commit b2c91dfa4b
7 changed files with 35 additions and 112 deletions

View file

@ -120,9 +120,6 @@ in rec {
}]; }];
tests = { tests = {
k8s-1_8 = runK8STests "1.8";
k8s-1_9 = runK8STests "1.9";
k8s-1_10 = runK8STests "1.10";
k8s-1_11 = runK8STests "1.11"; k8s-1_11 = runK8STests "1.11";
k8s-1_12 = runK8STests "1.12"; k8s-1_12 = runK8STests "1.12";
k8s-1_13 = runK8STests "1.13"; k8s-1_13 = runK8STests "1.13";

View file

@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> {} { pkgs ? import <nixpkgs> {}
, lib ? pkgs.lib , lib ? pkgs.lib
, kubenix ? import ../. { inherit pkgs lib; } , kubenix ? import ../. { inherit pkgs lib; }
, k8sVersion ? "1.13" , k8sVersion ? "1.18"
, nixosPath ? toString <nixpkgs/nixos> , nixosPath ? toString <nixpkgs/nixos>
# whether any testing error should throw an error # whether any testing error should throw an error
@ -25,7 +25,6 @@ let
./k8s/simple.nix ./k8s/simple.nix
./k8s/deployment.nix ./k8s/deployment.nix
./k8s/crd.nix ./k8s/crd.nix
./k8s/1.13/crd.nix
./k8s/defaults.nix ./k8s/defaults.nix
./k8s/order.nix ./k8s/order.nix
./k8s/submodule.nix ./k8s/submodule.nix
@ -33,7 +32,7 @@ let
./legacy/k8s.nix ./legacy/k8s.nix
./legacy/crd.nix ./legacy/crd.nix
./legacy/modules.nix ./legacy/modules.nix
./helm/simple.nix #./helm/simple.nix
./istio/bookinfo.nix ./istio/bookinfo.nix
./submodules/simple.nix ./submodules/simple.nix
./submodules/defaults.nix ./submodules/defaults.nix

View file

@ -34,7 +34,8 @@ in {
test = { test = {
name = "helm-simple"; name = "helm-simple";
description = "Simple k8s testing wheter name, apiVersion and kind are preset"; description = "Simple k8s testing wheter name, apiVersion and kind are preset";
enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; enable = false;
#enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0;
assertions = [{ assertions = [{
message = "should have generated resources"; message = "should have generated resources";
assertion = assertion =

View file

@ -1,40 +0,0 @@
{ config, lib, kubenix, k8sVersion, ... }:
with lib;
let
cfg = config.kubernetes.resources.customResourceDefinitions.crontabs;
in {
imports = with kubenix.modules; [ test k8s ];
test = {
name = "k8s-1-13-crd";
description = "Simple test testing CRD for k8s 1.13";
enable = builtins.compareVersions config.kubernetes.version "1.13" >= 0;
assertions = [{
message = "should have versions set";
assertion = (head cfg.spec.versions).name == "v1";
}];
};
kubernetes.version = k8sVersion;
kubernetes.resources.customResourceDefinitions.crontabs = {
metadata.name = "crontabs.stable.example.com";
spec = {
group = "stable.example.com";
versions = [{
name = "v1";
served = true;
storage = true;
}];
scope = "Namespaced";
names = {
plural = "crontabs";
singular = "crontab";
kind = "CronTab";
shortNames = ["ct"];
};
};
};
}

View file

@ -3,7 +3,6 @@
with lib; with lib;
let let
crd = config.kubernetes.api.resources.customResourceDefinitions.crontabs;
latestCrontab = config.kubernetes.api.resources.cronTabs.latest; latestCrontab = config.kubernetes.api.resources.cronTabs.latest;
in { in {
imports = with kubenix.modules; [ test k8s ]; imports = with kubenix.modules; [ test k8s ];
@ -13,11 +12,6 @@ in {
description = "Simple test tesing CRD"; description = "Simple test tesing CRD";
enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0;
assertions = [{ assertions = [{
message = "CRD should have group and version set";
assertion =
crd.spec.group == "stable.example.com" &&
crd.spec.version == "v1";
} {
message = "Custom resource should have correct version set"; message = "Custom resource should have correct version set";
assertion = latestCrontab.apiVersion == "stable.example.com/v2"; assertion = latestCrontab.apiVersion == "stable.example.com/v2";
}]; }];
@ -31,41 +25,11 @@ in {
kubernetes.version = k8sVersion; kubernetes.version = k8sVersion;
kubernetes.resources.customResourceDefinitions.crontabs = { kubernetes.customTypes = [
metadata.name = "crontabs.stable.example.com"; {
spec = {
group = "stable.example.com"; group = "stable.example.com";
version = "v1"; version = "v1";
scope = "Namespaced";
names = {
plural = "crontabs";
singular = "crontab";
kind = "CronTab"; kind = "CronTab";
shortNames = ["ct"];
};
};
};
kubernetes.resources.customResourceDefinitions.crontabsv2 = {
metadata.name = "crontabs.stable.example.com";
spec = {
group = "stable.example.com";
version = "v2";
scope = "Namespaced";
names = {
plural = "crontabs";
singular = "crontab";
kind = "CronTab";
shortNames = ["ct"];
};
};
};
kubernetes.createCustomTypesFromCRDs = true;
kubernetes.customTypes = mkMerge [
{
"stable.example.com/v1/CronTab" = {
attrName = "cronTabs"; attrName = "cronTabs";
description = "CronTabs resources"; description = "CronTabs resources";
module = { module = {
@ -74,10 +38,11 @@ in {
type = types.str; type = types.str;
}; };
}; };
};
} } {
{ group = "stable.example.com";
"stable.example.com/v2/CronTab" = { version = "v2";
kind = "CronTab";
description = "CronTabs resources"; description = "CronTabs resources";
attrName = "cronTabs"; attrName = "cronTabs";
module = { module = {
@ -93,10 +58,7 @@ in {
}; };
}; };
}; };
}; } {
}
[{
group = "stable.example.com"; group = "stable.example.com";
version = "v3"; version = "v3";
kind = "CronTab"; kind = "CronTab";
@ -115,7 +77,7 @@ in {
}; };
}; };
}; };
}] }
]; ];
kubernetes.resources."stable.example.com"."v1".CronTab.versioned.spec.schedule = "* * * * *"; kubernetes.resources."stable.example.com"."v1".CronTab.versioned.spec.schedule = "* * * * *";

View file

@ -10,7 +10,6 @@ in {
test = { test = {
name = "k8s-order"; name = "k8s-order";
description = "test tesing k8s resource order"; description = "test tesing k8s resource order";
enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0;
assertions = [{ assertions = [{
message = "should have correct order of resources"; message = "should have correct order of resources";
assertion = assertion =
@ -23,10 +22,15 @@ in {
kubernetes.version = k8sVersion; kubernetes.version = k8sVersion;
kubernetes.resources.customResourceDefinitions.crontabs = { kubernetes.resources.customResourceDefinitions.crontabs = {
apiVersion = "apiextensions.k8s.io/v1";
metadata.name = "crontabs.stable.example.com"; metadata.name = "crontabs.stable.example.com";
spec = { spec = {
group = "stable.example.com"; group = "stable.example.com";
version = "v1"; versions = [{
name = "v1";
served = true;
schema = true;
}];
scope = "Namespaced"; scope = "Namespaced";
names = { names = {
plural = "crontabs"; plural = "crontabs";

View file

@ -16,7 +16,7 @@ in {
test = { test = {
name = "legacy-crd"; name = "legacy-crd";
description = "Simple test tesing kubenix legacy integration with crds crd"; description = "Simple test tesing kubenix legacy integration with crds crd";
enable = builtins.compareVersions config.kubernetes.version "1.13" >= 0; enable = builtins.compareVersions config.kubernetes.version "1.15" <= 0;
assertions = [{ assertions = [{
message = "should define crd in module"; message = "should define crd in module";
assertion = assertion =