Search in sources :

Example 11 with ContainerResultMatcher

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

the class VertxMainITCase method startsWhenNotValidRepoConfigsArePresent.

@Test
void startsWhenNotValidRepoConfigsArePresent() throws IOException {
    this.deployment.putBinaryToArtipie("artipie-invalid-repo-config", "Hello world".getBytes(), "/var/artipie/data/my-file/item.txt");
    this.deployment.assertExec("Artipie started and responding 200", new ContainerResultMatcher(ContainerResultMatcher.SUCCESS, new StringContains("HTTP/1.1 500 Internal Server Error")), "curl", "-i", "-X", "GET", "http://artipie-invalid-repo-config:8080/my-file/item.txt");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 12 with ContainerResultMatcher

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

the class DebianITCase method setUp.

@BeforeEach
void setUp() throws IOException {
    this.containers.assertExec("Apt-get update failed", new ContainerResultMatcher(), "apt-get", "update");
    this.containers.assertExec("Failed to install curl", new ContainerResultMatcher(), "apt-get", "install", "-y", "curl");
    this.containers.assertExec("Failed to move debian sources.list", new ContainerResultMatcher(), "mv", "/w/sources.list", "/etc/apt/");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with ContainerResultMatcher

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

the class DebianITCase 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(), "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");
}
Also used : StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Example 14 with ContainerResultMatcher

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

the class CondaITCase method init.

@BeforeEach
void init() throws IOException {
    this.containers.assertExec("Conda-build install failed", new ContainerResultMatcher(), "conda", "install", "-y", "conda-build");
    this.containers.assertExec("Conda-verify install failed", new ContainerResultMatcher(), "conda", "install", "-y", "conda-verify");
    this.containers.assertExec("Conda-client install failed", new ContainerResultMatcher(), "conda", "install", "-y", "anaconda-client");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 15 with ContainerResultMatcher

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

the class CondaITCase method canUploadToArtipie.

@Test
void canUploadToArtipie() throws IOException {
    this.moveCondarc();
    this.containers.assertExec("Failed to set anaconda upload url", new ContainerResultMatcher(), "anaconda", "config", "--set", "url", "http://artipie:8080/my-conda/", "-s");
    this.containers.assertExec("Failed to set anaconda upload flag", new ContainerResultMatcher(), "conda", "config", "--set", "anaconda_upload", "yes");
    this.containers.assertExec("Login was not successful", new ContainerResultMatcher(), "anaconda", "login", "--username", "any", "--password", "any");
    this.containers.assertExec("Package was not installed successfully", new ContainerResultMatcher(new IsEqual<>(0), Matchers.allOf(new StringContains("Using Anaconda API: http://artipie:8080/my-conda/"), // @checkstyle LineLengthCheck (1 line)
    new StringContains("Uploading file \"anonymous/example-package/0.0.1/linux-64/example-package-0.0.1-0.tar.bz2\""), new StringContains("Upload complete"))), "conda", "build", "--output-folder", "/w/conda-out/", "/w/example-project/conda/");
    this.containers.assertArtipieContent("Package was not uploaded to artipie", "/var/artipie/data/my-conda/linux-64/example-package-0.0.1-0.tar.bz2", new IsNot<>(new IsNull<>()));
    this.containers.assertArtipieContent("Package was not uploaded to artipie", "/var/artipie/data/my-conda/linux-64/repodata.json", new IsNot<>(new IsNull<>()));
}
Also used : IsNull(org.hamcrest.core.IsNull) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) 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