mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
tests(cilib_test) Extended test definition for the ci lib
Extended the definition of tests for the continuous integration library, allowing for more in-depth testing of odd behavior of some library functions.
This commit is contained in:
parent
524bdf9cdc
commit
58a0db7861
1 changed files with 164 additions and 28 deletions
|
|
@ -56,11 +56,29 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "jobPatched nix disabled";
|
name = "jobPatched nix disabled";
|
||||||
expected = {};
|
expected = {
|
||||||
|
/*cache = [{
|
||||||
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};*/
|
||||||
|
};
|
||||||
actual = mkJobPatched {
|
actual = mkJobPatched {
|
||||||
key = "test";
|
key = "test";
|
||||||
pipelineName = "test";
|
pipelineName = "test";
|
||||||
job = {};
|
job = {
|
||||||
|
cache = [{
|
||||||
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};
|
||||||
|
};
|
||||||
nixConfig.enable = false;
|
nixConfig.enable = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -69,11 +87,28 @@
|
||||||
expected = {
|
expected = {
|
||||||
after_script = [ "finalize_nix_ci" ];
|
after_script = [ "finalize_nix_ci" ];
|
||||||
before_script = [ "source setup_nix_ci \"gitlab-ci:pipeline:test:job-deps:test\"" ];
|
before_script = [ "source setup_nix_ci \"gitlab-ci:pipeline:test:job-deps:test\"" ];
|
||||||
|
variables = {
|
||||||
|
#BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};
|
||||||
|
cache = [{
|
||||||
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}];
|
||||||
};
|
};
|
||||||
actual = mkJobPatched {
|
actual = mkJobPatched {
|
||||||
key = "test";
|
key = "test";
|
||||||
pipelineName = "test";
|
pipelineName = "test";
|
||||||
job = {};
|
job = {
|
||||||
|
cache = [{
|
||||||
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};
|
||||||
|
};
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableRunnerCache = false;
|
enableRunnerCache = false;
|
||||||
|
|
@ -85,18 +120,32 @@
|
||||||
expected = {
|
expected = {
|
||||||
after_script = [ "finalize_nix_ci" ];
|
after_script = [ "finalize_nix_ci" ];
|
||||||
before_script = [ "source setup_nix_ci \"gitlab-ci:pipeline:test:job-deps:test\"" ];
|
before_script = [ "source setup_nix_ci \"gitlab-ci:pipeline:test:job-deps:test\"" ];
|
||||||
cache = [
|
cache = [{
|
||||||
{
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}{
|
||||||
key = "test";
|
key = "test";
|
||||||
paths = [ ".nix-cache/" ];
|
paths = [ ".nix-cache/" ];
|
||||||
}
|
}];
|
||||||
];
|
variables = {
|
||||||
variables."NIX_CI_CACHE_STRATEGY" = "runner";
|
NIX_CI_CACHE_STRATEGY = "runner";
|
||||||
|
#BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
actual = mkJobPatched {
|
actual = mkJobPatched {
|
||||||
key = "test";
|
key = "test";
|
||||||
pipelineName = "test";
|
pipelineName = "test";
|
||||||
job = {};
|
job = {
|
||||||
|
cache = [{
|
||||||
|
name = "some";
|
||||||
|
paths = [ "this" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
BASH = toString pkgs.bash;
|
||||||
|
TEST = "work";
|
||||||
|
};
|
||||||
|
};
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableRunnerCache = true;
|
enableRunnerCache = true;
|
||||||
|
|
@ -145,20 +194,107 @@
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "handle store paths in variables";
|
name = "handle store paths in variables without nix config";
|
||||||
expected = {
|
expected = {
|
||||||
stages = [ "test" ];
|
stages = [ "test" ];
|
||||||
test.stage = "test";
|
variables = {
|
||||||
|
EXAMPLE = "empty";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
};
|
};
|
||||||
actual =
|
test = {
|
||||||
(mkPipeline {
|
stage = "test";
|
||||||
|
before_script = [ "./init" ];
|
||||||
|
script = [ "echo Hello World!" ];
|
||||||
|
after_script = [ "./clean" ];
|
||||||
|
/*cache = [{
|
||||||
|
key = "simple";
|
||||||
|
paths = [ "~/random/" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
SAMPLE = "working";
|
||||||
|
HELLO = toString pkgs.hello;
|
||||||
|
};*/
|
||||||
|
};
|
||||||
|
};
|
||||||
|
actual = (mkPipeline {
|
||||||
name = "test";
|
name = "test";
|
||||||
nixConfig.enable = false;
|
nixConfig.enable = false;
|
||||||
pipeline = {
|
pipeline = {
|
||||||
stages = [ "test" ];
|
stages = [ "test" ];
|
||||||
|
variables = {
|
||||||
|
EXAMPLE = "empty";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
|
};
|
||||||
jobs.test = {
|
jobs.test = {
|
||||||
stage = "test";
|
stage = "test";
|
||||||
variables."TEST" = "${pkgs.hello}";
|
before_script = [ "./init" ];
|
||||||
|
script = [ "echo Hello World!" ];
|
||||||
|
after_script = [ "./clean" ];
|
||||||
|
cache = [{
|
||||||
|
key = "simple";
|
||||||
|
paths = [ "~/random/" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
SAMPLE = "working";
|
||||||
|
HELLO = toString pkgs.hello;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}).finalConfig;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "handle store paths in variables with nix config";
|
||||||
|
expected = {
|
||||||
|
stages = [ "test" ];
|
||||||
|
variables = {
|
||||||
|
EXAMPLE = "empty";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
|
};
|
||||||
|
test = {
|
||||||
|
stage = "test";
|
||||||
|
before_script = [ "source setup_nix_ci \"gitlab-ci:pipeline:test:job-deps:test\"" "./init" ];
|
||||||
|
script = [ "echo Hello World!" ];
|
||||||
|
after_script = [ "./clean" "finalize_nix_ci" ];
|
||||||
|
cache = [{
|
||||||
|
key = "simple";
|
||||||
|
paths = [ "~/random/" ];
|
||||||
|
}{
|
||||||
|
key = "random";
|
||||||
|
paths = [ ".nix-cache/" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
SAMPLE = "working";
|
||||||
|
#HELLO = toString pkgs.hello;
|
||||||
|
NIX_CI_CACHE_STRATEGY = "runner";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
actual = (mkPipeline {
|
||||||
|
name = "test";
|
||||||
|
nixConfig = {
|
||||||
|
enable = true;
|
||||||
|
enableRunnerCache = true;
|
||||||
|
runnerCacheKey = "random";
|
||||||
|
};
|
||||||
|
pipeline = {
|
||||||
|
stages = [ "test" ];
|
||||||
|
variables = {
|
||||||
|
EXAMPLE = "empty";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
|
};
|
||||||
|
jobs.test = {
|
||||||
|
stage = "test";
|
||||||
|
before_script = [ "./init" ];
|
||||||
|
script = [ "echo Hello World!" ];
|
||||||
|
after_script = [ "./clean" ];
|
||||||
|
cache = [{
|
||||||
|
key = "simple";
|
||||||
|
paths = [ "~/random/" ];
|
||||||
|
}];
|
||||||
|
variables = {
|
||||||
|
SAMPLE = "working";
|
||||||
|
HELLO = toString pkgs.hello;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}).finalConfig;
|
}).finalConfig;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue