mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
tests.testers.testBuildFailure': add negative tests for exit code check and log check
This commit is contained in:
parent
8ef0cbd15b
commit
467cbf403b
1 changed files with 28 additions and 0 deletions
|
@ -114,6 +114,34 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
sideEffectsStructuredAttrs = overrideStructuredAttrs true final.sideEffects;
|
sideEffectsStructuredAttrs = overrideStructuredAttrs true final.sideEffects;
|
||||||
|
|
||||||
|
exitCodeNegativeTest = testers.testBuildFailure' {
|
||||||
|
drv = testers.testBuildFailure' {
|
||||||
|
drv = runCommand "exit-code" { } "exit 3";
|
||||||
|
# Default expected exit code is 1
|
||||||
|
};
|
||||||
|
expectedBuilderLogEntries = [
|
||||||
|
"ERROR: testBuilderExitCode: original builder produced exit code 3 but was expected to produce 1"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
exitCodeNegativeTestStructuredAttrs = overrideStructuredAttrs true final.exitCodeNegativeTest;
|
||||||
|
|
||||||
|
logNegativeTest = testers.testBuildFailure' {
|
||||||
|
drv = testers.testBuildFailure' {
|
||||||
|
drv = runCommand "exit-code" { } ''
|
||||||
|
nixLog "apples"
|
||||||
|
exit 3
|
||||||
|
'';
|
||||||
|
expectedBuilderExitCode = 3;
|
||||||
|
expectedBuilderLogEntries = [ "bees" ];
|
||||||
|
};
|
||||||
|
expectedBuilderLogEntries = [
|
||||||
|
"ERROR: testBuilderLogEntries: original builder log does not contain 'bees'"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
logNegativeTestStructuredAttrs = overrideStructuredAttrs true final.logNegativeTest;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
final
|
final
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue