From b3e10fecb38bf8da480586014fe08b4463966276 Mon Sep 17 00:00:00 2001 From: "a.karlov" Date: Tue, 4 Dec 2018 18:47:17 +0300 Subject: [PATCH] BJ-314: fix --- pom.xml | 2 +- .../file/storage/AbstractIntegrationTest.java | 38 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index e3a2bf8..7856a19 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 22c57470c4fc47161894f036b7cf9d70f42b75f5 0.2.1 1.1.15 - 1.8-c23437f + 1.10-f44896e 0.6.8 2.8.0 diff --git a/src/test/java/com/rbkmoney/file/storage/AbstractIntegrationTest.java b/src/test/java/com/rbkmoney/file/storage/AbstractIntegrationTest.java index 2e4f30c..d8cfcf5 100644 --- a/src/test/java/com/rbkmoney/file/storage/AbstractIntegrationTest.java +++ b/src/test/java/com/rbkmoney/file/storage/AbstractIntegrationTest.java @@ -2,6 +2,7 @@ package com.rbkmoney.file.storage; import com.rbkmoney.woody.thrift.impl.http.THSpawnClientBuilder; import org.junit.Before; +import org.junit.ClassRule; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.util.EnvironmentTestUtils; @@ -11,12 +12,15 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -42,21 +46,21 @@ public abstract class AbstractIntegrationTest { protected FileStorageSrv.Iface client; -// @ClassRule -// public static GenericContainer cephContainer = new GenericContainer("dr.rbkmoney.com/ceph-demo:latest") -// .withEnv("RGW_NAME", "localhost") -// .withEnv("NETWORK_AUTO_DETECT", "4") -// .withEnv("CEPH_DEMO_UID", "ceph-test") -// .withEnv("CEPH_DEMO_ACCESS_KEY", AWS_ACCESS_KEY) -// .withEnv("CEPH_DEMO_SECRET_KEY", AWS_SECRET_KEY) -// .withEnv("CEPH_DEMO_BUCKET", BUCKET_NAME) -// .withExposedPorts(5000, 80) -// .waitingFor( -// new HttpWaitStrategy() -// .forPath("/api/v0.1/health") -// .forStatusCode(200) -// .withStartupTimeout(Duration.ofMinutes(10)) -// ); + @ClassRule + public static GenericContainer cephContainer = new GenericContainer("dr.rbkmoney.com/ceph-demo:latest") + .withEnv("RGW_NAME", "localhost") + .withEnv("NETWORK_AUTO_DETECT", "4") + .withEnv("CEPH_DEMO_UID", "ceph-test") + .withEnv("CEPH_DEMO_ACCESS_KEY", AWS_ACCESS_KEY) + .withEnv("CEPH_DEMO_SECRET_KEY", AWS_SECRET_KEY) + .withEnv("CEPH_DEMO_BUCKET", BUCKET_NAME) + .withExposedPorts(5000, 80) + .waitingFor( + new HttpWaitStrategy() + .forPath("/api/v0.1/health") + .forStatusCode(200) + .withStartupTimeout(Duration.ofMinutes(10)) + ); public static class Initializer implements ApplicationContextInitializer { @Override @@ -64,9 +68,9 @@ public abstract class AbstractIntegrationTest { EnvironmentTestUtils.addEnvironment( "testcontainers", configurableApplicationContext.getEnvironment(), -// "storage.endpoint=" + cephContainer.getContainerIpAddress() + ":" + cephContainer.getMappedPort(80), + "storage.endpoint=" + cephContainer.getContainerIpAddress() + ":" + cephContainer.getMappedPort(80), // в случае, если поднят локальный сторедж в контейнере - "storage.endpoint=localhost:32827", + //"storage.endpoint=localhost:32827", "storage.signingRegion=" + SIGNING_REGION, "storage.accessKey=" + AWS_ACCESS_KEY, "storage.secretKey=" + AWS_SECRET_KEY,