mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
dockerTools.buildImage: test that created=now makes an unstable date
This commit is contained in:
parent
3222fe1756
commit
aedc651903
@ -20,7 +20,10 @@ import ./make-test.nix ({ pkgs, ... }: {
|
||||
''
|
||||
$docker->waitForUnit("sockets.target");
|
||||
|
||||
# Ensure Docker images use a stable date by default
|
||||
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
||||
$docker->succeed("[ '1970-01-01T00:00:01Z' = \"\$(docker inspect ${pkgs.dockerTools.examples.bash.imageName} | ${pkgs.jq}/bin/jq -r .[].Created)\" ]");
|
||||
|
||||
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version");
|
||||
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.bash.imageName}");
|
||||
|
||||
@ -51,5 +54,9 @@ import ./make-test.nix ({ pkgs, ... }: {
|
||||
$docker->succeed("docker run --rm runasrootextracommands cat extraCommands");
|
||||
$docker->succeed("docker run --rm runasrootextracommands cat runAsRoot");
|
||||
$docker->succeed("docker rmi '${pkgs.dockerTools.examples.runAsRootExtraCommands.imageName}'");
|
||||
|
||||
# Ensure Docker images can use an unstable date
|
||||
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
||||
$docker->succeed("[ '1970-01-01T00:00:01Z' != \"\$(docker inspect ${pkgs.dockerTools.examples.unstableDate.imageName} | ${pkgs.jq}/bin/jq -r .[].Created)\" ]");
|
||||
'';
|
||||
})
|
||||
|
@ -141,4 +141,13 @@ rec {
|
||||
runAsRoot = ''echo "(runAsRoot)" > runAsRoot'';
|
||||
extraCommands = ''echo "(extraCommand)" > extraCommands'';
|
||||
};
|
||||
|
||||
# 9. Ensure that setting created to now results in a date which
|
||||
# isn't the epoch + 1
|
||||
unstableDate = pkgs.dockerTools.buildImage {
|
||||
name = "unstable-date";
|
||||
tag = "latest";
|
||||
contents = [ pkgs.coreutils ];
|
||||
created = "now";
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user