use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.
the class DockerLocalAuthIT method shouldFailPushIfNoWritePermission.
@Test
void shouldFailPushIfNoWritePermission() throws Exception {
final String image = "artipie:8080/registry/alpine:3.11";
List.of(Pair.of("Failed to login to Artipie", List.of("docker", "login", "--username", "bob", "--password", "qwerty", "artipie:8080")), Pair.of("Failed to pull origin image", List.of("docker", "pull", "alpine:3.11")), Pair.of("Failed to tag origin image", List.of("docker", "tag", "alpine:3.11", image))).forEach(pair -> pair.accept((msg, cmds) -> {
try {
this.deployment.assertExec(msg, new ContainerResultMatcher(), cmds);
} catch (final IOException err) {
throw new UncheckedIOException(err);
}
}));
this.deployment.assertExec("Push failed with unexpected status, should be 1", new ContainerResultMatcher(new IsEqual<>(1)), "docker", "push", image);
}
use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.
the class DebianGpgITCase method pushAndInstallWorks.
@Test
void pushAndInstallWorks() throws Exception {
this.containers.assertExec("Failed to upload deb package", new ContainerResultMatcher(), "curl", "http://artipie:8080/my-debian/main/aglfn_1.7-3_amd64.deb", "--upload-file", "/w/aglfn_1.7-3_amd64.deb");
this.containers.assertExec("Apt-get update failed", new ContainerResultMatcher(new IsEqual<>(0), new AllOf<String>(new ListOf<Matcher<? super String>>(new StringContains("Get:1 http://artipie:8080/my-debian my-debian InRelease"), new StringContains("Get:2 http://artipie:8080/my-debian my-debian/main amd64 Packages"), new IsNot<>(new StringContains("Get:3"))))), "apt-get", "update");
this.containers.assertExec("Package was not downloaded and unpacked", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(new ListOf<>("Unpacking aglfn", "Setting up aglfn"))), "apt-get", "install", "-y", "aglfn");
}
use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.
the class PypiProxyITCase method installFromProxy.
@Test
void installFromProxy() throws Exception {
final byte[] data = new TestResource("pypi-repo/alarmtime-0.1.5.tar.gz").asBytes();
this.containers.putBinaryToArtipie("artipie", data, "/var/artipie/data/my-pypi/alarmtime/alarmtime-0.1.5.tar.gz");
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), Matchers.containsString("Successfully installed alarmtime-0.1.5")), "pip", "install", "--no-deps", "--trusted-host", "artipie-proxy", "--index-url", "http://alice:123@artipie-proxy:8080/my-pypi-proxy/", "alarmtime");
this.containers.assertArtipieContent("artipie-proxy", "/var/artipie/data/my-pypi-proxy/alarmtime/alarmtime-0.1.5.tar.gz", new IsEqual<>(data));
}
use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.
the class NpmProxyITCase method installFromProxy.
@Test
void installFromProxy() throws Exception {
this.containers.putBinaryToArtipie("artipie", new TestResource(String.format("npm/storage/%s/meta.json", NpmProxyITCase.PROJ)).asBytes(), String.format("/var/artipie/data/my-npm/%s/meta.json", NpmProxyITCase.PROJ));
final byte[] tgz = new TestResource(String.format("npm/storage/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ)).asBytes();
this.containers.putBinaryToArtipie("artipie", tgz, String.format("/var/artipie/data/my-npm/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ));
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(Arrays.asList(NpmProxyITCase.ADDED_PROJ, "added 1 package"))), "npm", "install", NpmProxyITCase.PROJ, "--registry", "http://artipie-proxy:8080/my-npm-proxy");
this.containers.assertArtipieContent("artipie-proxy", "Package was not cached in proxy", String.format("/var/artipie/data/my-npm-proxy/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ), new IsEqual<>(tgz));
}
use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.
the class PypiITCase method installPythonPackage.
@Test
void installPythonPackage() throws IOException {
final String meta = "pypi-repo/example-pckg/dist/artipietestpkg-0.0.3.tar.gz";
this.containers.putResourceToArtipie(meta, "/var/artipie/data/my-python/artipietestpkg/artipietestpkg-0.0.3.tar.gz");
this.containers.assertExec("Failed to install package", new ContainerResultMatcher(Matchers.equalTo(0), new StringContainsInOrder(new ListOf<>("Looking in indexes: http://artipie:8080/my-python", "Collecting artipietestpkg", String.format(" Downloading http://artipie:8080/my-python/artipietestpkg/%s", "artipietestpkg-0.0.3.tar.gz"), "Building wheels for collected packages: artipietestpkg", " Building wheel for artipietestpkg (setup.py): started", String.format(" Building wheel for artipietestpkg (setup.py): %s", "finished with status 'done'"), "Successfully built artipietestpkg", "Installing collected packages: artipietestpkg", "Successfully installed artipietestpkg-0.0.3"))), "python", "-m", "pip", "install", "--trusted-host", "artipie", "--index-url", "http://artipie:8080/my-python", "artipietestpkg");
}
Aggregations