diff options
author | Michele Catalano <michele@catalano.de> | 2018-04-06 15:11:52 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2018-05-01 15:23:47 +0200 |
commit | afd3136e8efe2cbd477cb6db7be5ad7b2eb7efc6 (patch) | |
tree | ed76d7008c48e4d746db480cad607561e668af17 /nixos/tests | |
parent | 593dc4514192354491473ba00e1b9104f456c50c (diff) |
nixos/docker-registry: Add support for garbage collector to docker registry
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/docker-registry.nix | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/nixos/tests/docker-registry.nix b/nixos/tests/docker-registry.nix index 943773ee3918..1fbd199c7bc4 100644 --- a/nixos/tests/docker-registry.nix +++ b/nixos/tests/docker-registry.nix @@ -3,7 +3,7 @@ import ./make-test.nix ({ pkgs, ...} : { name = "docker-registry"; meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ globin ma27 ]; + maintainers = [ globin ma27 ironpinguin ]; }; nodes = { @@ -12,6 +12,7 @@ import ./make-test.nix ({ pkgs, ...} : { services.dockerRegistry.enableDelete = true; services.dockerRegistry.port = 8080; services.dockerRegistry.listenAddress = "0.0.0.0"; + services.dockerRegistry.enableGarbageCollect = true; networking.firewall.allowedTCPPorts = [ 8080 ]; }; @@ -23,7 +24,6 @@ import ./make-test.nix ({ pkgs, ...} : { client2 = { config, pkgs, ...}: { virtualisation.docker.enable = true; virtualisation.docker.extraOptions = "--insecure-registry registry:8080"; - environment.systemPackages = [ pkgs.jq ]; }; }; @@ -35,6 +35,7 @@ import ./make-test.nix ({ pkgs, ...} : { $registry->start(); $registry->waitForUnit("docker-registry.service"); + $registry->waitForOpenPort("8080"); $client1->succeed("docker push registry:8080/scratch"); $client2->start(); @@ -43,7 +44,20 @@ import ./make-test.nix ({ pkgs, ...} : { $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\')' + 'curl -fsS -X DELETE registry:8080/v2/scratch/manifests/$(curl -fsS -I -H"Accept: application/vnd.docker.distribution.manifest.v2+json" registry:8080/v2/scratch/manifests/latest | grep Docker-Content-Digest | sed -e \'s/Docker-Content-Digest: //\' | tr -d \'\r\')' + ); + + $registry->systemctl("start docker-registry-garbage-collect.service"); + $registry->waitUntilFails("systemctl status docker-registry-garbage-collect.service"); + $registry->waitForUnit("docker-registry.service"); + + $registry->fail( + 'ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data' + ); + + $client1->succeed("docker push registry:8080/scratch"); + $registry->succeed( + 'ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data' ); ''; }) |