Search in sources :

Example 6 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class MavenITCase method deploysArtifact.

@ParameterizedTest
@CsvSource({ "helloworld,0.1,0.1", "snapshot,1.0-SNAPSHOT" })
void deploysArtifact(final String type, final String vers) throws Exception {
    this.containers.putBinaryToClient(new TestResource(String.format("%s-src/pom.xml", type)).asBytes(), "/w/pom.xml");
    this.containers.assertExec("Deploy failed", new ContainerResultMatcher(ContainerResultMatcher.SUCCESS), "mvn", "-B", "-q", "-s", "settings.xml", "deploy", "-Dmaven.install.skip=true");
    this.containers.assertExec("Download failed", new ContainerResultMatcher(ContainerResultMatcher.SUCCESS), "mvn", "-B", "-q", "-s", "settings.xml", "-U", "dependency:get", String.format("-Dartifact=com.artipie:%s:%s", type, vers));
}
Also used : TestResource(com.artipie.asto.test.TestResource) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class MavenProxyIT method shouldGetArtifactFromCentralAndSaveInCache.

@Test
void shouldGetArtifactFromCentralAndSaveInCache() throws Exception {
    this.containers.assertExec("Artifact wasn't downloaded", new ContainerResultMatcher(new IsEqual<>(0), new StringContains("BUILD SUCCESS")), "mvn", "-s", "settings.xml", "dependency:get", "-Dartifact=args4j:args4j:2.32:jar");
    this.containers.assertArtipieContent("Artifact wasn't saved in cache", "/var/artipie/data/my-maven/args4j/args4j/2.32/args4j-2.32.jar", new IsAnything<>());
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 8 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class DockerLocalAuthIT method shouldFailPushIfAnonymous.

@Test
void shouldFailPushIfAnonymous() throws IOException {
    final String image = "artipie:8080/registry/alpine:3.11";
    List.of(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);
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) UncheckedIOException(java.io.UncheckedIOException) Test(org.junit.jupiter.api.Test) TestDeployment(com.artipie.test.TestDeployment) BeforeEach(org.junit.jupiter.api.BeforeEach) List(java.util.List) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) OS(org.junit.jupiter.api.condition.OS) IsEqual(org.hamcrest.core.IsEqual) Pair(wtf.g4s8.tuples.Pair) IOException(java.io.IOException) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) UncheckedIOException(java.io.UncheckedIOException) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Example 9 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class DockerOnPortIT method shouldPullPushed.

@Test
void shouldPullPushed() throws Exception {
    this.deployment.clientExec("docker", "push", this.image.remote());
    this.deployment.clientExec("docker", "image", "rm", this.image.name());
    this.deployment.clientExec("docker", "image", "rm", this.image.remote());
    this.deployment.assertExec("Filed to pull image", new ContainerResultMatcher(new IsEqual<>(ContainerResultMatcher.SUCCESS), new StringContains(String.format("Status: Downloaded newer image for %s", this.image.remote()))), "docker", "pull", this.image.remote());
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 10 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class PhpComposerITCase method canUploadAndInstall.

@Test
void canUploadAndInstall() throws IOException {
    final String url = "http://artipie:8080/php";
    this.containers.assertExec("Failed to upload composer package archive", new ContainerResultMatcher(), "curl", "-X", "PUT", String.format("%s/%s", url, "log-1.1.4.zip"), "--upload-file", String.format("/w/%s", PhpComposerITCase.PACK), "--verbose");
    this.containers.assertExec("Failed to install uploaded package", new ContainerResultMatcher(), "env", "COMPOSER=/w/repo/composer.json", "composer", "install", "--verbose", "--no-cache");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) Test(org.junit.jupiter.api.Test)

Aggregations

ContainerResultMatcher (com.artipie.test.ContainerResultMatcher)34 Test (org.junit.jupiter.api.Test)27 IsEqual (org.hamcrest.core.IsEqual)20 StringContains (org.hamcrest.core.StringContains)14 TestResource (com.artipie.asto.test.TestResource)10 StringContainsInOrder (org.hamcrest.text.StringContainsInOrder)10 BeforeEach (org.junit.jupiter.api.BeforeEach)8 TestDeployment (com.artipie.test.TestDeployment)7 OS (org.junit.jupiter.api.condition.OS)7 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)7 DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)6 IOException (java.io.IOException)4 UncheckedIOException (java.io.UncheckedIOException)4 List (java.util.List)4 BindMode (org.testcontainers.containers.BindMode)3 Pair (wtf.g4s8.tuples.Pair)3 MapEntry (org.cactoos.map.MapEntry)2 MapOf (org.cactoos.map.MapOf)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 CsvSource (org.junit.jupiter.params.provider.CsvSource)2