mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
Merge pull request #74033 from Ma27/port-docker-registry-test
nixos/docker-registry: port test to python test-driver
This commit is contained in:
commit
4e007fb1f6
@ -1,6 +1,6 @@
|
||||
# This test runs docker-registry and check if it works
|
||||
|
||||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||
name = "docker-registry";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ globin ma27 ironpinguin ];
|
||||
@ -28,36 +28,34 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
$client1->start();
|
||||
$client1->waitForUnit("docker.service");
|
||||
$client1->succeed("tar cv --files-from /dev/null | docker import - scratch");
|
||||
$client1->succeed("docker tag scratch registry:8080/scratch");
|
||||
client1.start()
|
||||
client1.wait_for_unit("docker.service")
|
||||
client1.succeed("tar cv --files-from /dev/null | docker import - scratch")
|
||||
client1.succeed("docker tag scratch registry:8080/scratch")
|
||||
|
||||
$registry->start();
|
||||
$registry->waitForUnit("docker-registry.service");
|
||||
$registry->waitForOpenPort("8080");
|
||||
$client1->succeed("docker push registry:8080/scratch");
|
||||
registry.start()
|
||||
registry.wait_for_unit("docker-registry.service")
|
||||
registry.wait_for_open_port("8080")
|
||||
client1.succeed("docker push registry:8080/scratch")
|
||||
|
||||
$client2->start();
|
||||
$client2->waitForUnit("docker.service");
|
||||
$client2->succeed("docker pull registry:8080/scratch");
|
||||
$client2->succeed("docker images | grep scratch");
|
||||
client2.start()
|
||||
client2.wait_for_unit("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 -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\')'
|
||||
);
|
||||
client2.succeed(
|
||||
"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.systemctl("start docker-registry-garbage-collect.service")
|
||||
registry.wait_until_fails("systemctl status docker-registry-garbage-collect.service")
|
||||
registry.wait_for_unit("docker-registry.service")
|
||||
|
||||
$registry->fail(
|
||||
'ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data'
|
||||
);
|
||||
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'
|
||||
);
|
||||
client1.succeed("docker push registry:8080/scratch")
|
||||
registry.succeed(
|
||||
"ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data"
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user