summary refs log tree commit diff
path: root/nixos/tests/docker-registry.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-03-26 13:54:01 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2018-05-01 15:23:39 +0200
commit593dc4514192354491473ba00e1b9104f456c50c (patch)
treefda34958f5130dce880cb558397a02c9241f8b8e /nixos/tests/docker-registry.nix
parentf5c0b3f887a90c0dee1467d6e3ac151d4a2e9649 (diff)
downloadnixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar.gz
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar.bz2
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar.lz
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar.xz
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.tar.zst
nixpkgs-593dc4514192354491473ba00e1b9104f456c50c.zip
nixos/docker-registry: cleanup module definition & enhance testcase
The following changes have been applied:

- the property `http.headers.X-Content-Type-Options` must a list of
  strings rather than a serialized list
- instead of `/etc/docker/registry/config.yml` the configuration will be
  written with `pkgs.writeText` and the store path will be used to run
  the registry. This reduces the risk of possible impurities by relying
  on the Nix store only.
- cleaned up the property paths to easy readability and reduce the
  verbosity.
- enhanced the testcase to ensure that digests can be deleted as well
- the `services.docker-registry.extraConfig` object will be merged with
  `registryConfig`

/cc @ironpinguin
Diffstat (limited to 'nixos/tests/docker-registry.nix')
-rw-r--r--nixos/tests/docker-registry.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/tests/docker-registry.nix b/nixos/tests/docker-registry.nix
index 109fca440e5..943773ee391 100644
--- a/nixos/tests/docker-registry.nix
+++ b/nixos/tests/docker-registry.nix
@@ -3,12 +3,13 @@
 import ./make-test.nix ({ pkgs, ...} : {
   name = "docker-registry";
   meta = with pkgs.stdenv.lib.maintainers; {
-    maintainers = [ globin ];
+    maintainers = [ globin ma27 ];
   };
 
   nodes = {
     registry = { config, pkgs, ... }: {
       services.dockerRegistry.enable = true;
+      services.dockerRegistry.enableDelete = true;
       services.dockerRegistry.port = 8080;
       services.dockerRegistry.listenAddress = "0.0.0.0";
       networking.firewall.allowedTCPPorts = [ 8080 ];
@@ -22,6 +23,7 @@ import ./make-test.nix ({ pkgs, ...} : {
     client2 = { config, pkgs, ...}: {
       virtualisation.docker.enable = true;
       virtualisation.docker.extraOptions = "--insecure-registry registry:8080";
+      environment.systemPackages = [ pkgs.jq ];
     };
   };
 
@@ -39,5 +41,9 @@ import ./make-test.nix ({ pkgs, ...} : {
     $client2->waitForUnit("docker.service");
     $client2->succeed("docker pull registry:8080/scratch");
     $client2->succeed("docker images | grep scratch");
+
+    $client2->succeed(
+      'curl -fsS -X DELETE registry:8080/v2/scratch/manifests/$(curl registry:8080/v2/scratch/manifests/latest | jq ".fsLayers[0].blobSum" | sed -e \'s/"//g\')'
+    );
   '';
 })