mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #47017 from grahamc/docker-tools-test
dockerTools.buildImage: test that created=now makes an unstable date
This commit is contained in:
commit
10450ffd5b
2 changed files with 16 additions and 0 deletions
|
@ -20,7 +20,10 @@ import ./make-test.nix ({ pkgs, ... }: {
|
||||||
''
|
''
|
||||||
$docker->waitForUnit("sockets.target");
|
$docker->waitForUnit("sockets.target");
|
||||||
|
|
||||||
|
# Ensure Docker images use a stable date by default
|
||||||
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
$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 run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version");
|
||||||
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.bash.imageName}");
|
$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 extraCommands");
|
||||||
$docker->succeed("docker run --rm runasrootextracommands cat runAsRoot");
|
$docker->succeed("docker run --rm runasrootextracommands cat runAsRoot");
|
||||||
$docker->succeed("docker rmi '${pkgs.dockerTools.examples.runAsRootExtraCommands.imageName}'");
|
$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'';
|
runAsRoot = ''echo "(runAsRoot)" > runAsRoot'';
|
||||||
extraCommands = ''echo "(extraCommand)" > extraCommands'';
|
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 a new issue