diff --git a/oap-server/server-configuration/configuration-apollo/pom.xml b/oap-server/server-configuration/configuration-apollo/pom.xml index 10ff31c2c7f1..38979e7b1278 100644 --- a/oap-server/server-configuration/configuration-apollo/pom.xml +++ b/oap-server/server-configuration/configuration-apollo/pom.xml @@ -58,6 +58,18 @@ + + kezhenxu94/apollo:latest + ${mysql.host} + ${mysql.port} + Portal started. You can visit + 240000 + apollo-db + apollo-db + +apollo.portal.host:apollo.portal.port:8070 + +apollo.meta.host:apollo.meta.port:8080 + + CI-with-IT @@ -71,7 +83,7 @@ true default true - IfNotPresent + Always mysql:5.7 @@ -79,9 +91,12 @@ Asia/Shanghai + 127.0.0.1 yes - none + + +mysql.host:mysql.port:3306 + @@ -90,31 +105,17 @@ - ready for connections + socket: '/var/run/mysqld/mysqld.sock' port: 3306 - kezhenxu94/apollo:1.2 apollo-config-and-portal - - none - - apollo-db - - - apollo-db - - - +apollo.portal.host:apollo.portal.port:8070 - +apollo.meta.host:apollo.meta.port:8080 - - - Portal started. You can visit - - - + + properties + apollo.docker + diff --git a/oap-server/server-configuration/configuration-apollo/src/test/java/org/apache/skywalking/oap/server/configuration/apollo/ITApolloConfigurationTest.java b/oap-server/server-configuration/configuration-apollo/src/test/java/org/apache/skywalking/oap/server/configuration/apollo/ITApolloConfigurationTest.java index 550749d14e9d..ab97cd614f18 100644 --- a/oap-server/server-configuration/configuration-apollo/src/test/java/org/apache/skywalking/oap/server/configuration/apollo/ITApolloConfigurationTest.java +++ b/oap-server/server-configuration/configuration-apollo/src/test/java/org/apache/skywalking/oap/server/configuration/apollo/ITApolloConfigurationTest.java @@ -18,11 +18,11 @@ package org.apache.skywalking.oap.server.configuration.apollo; -import org.apache.http.client.ResponseHandler; +import org.apache.http.client.HttpResponseException; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.skywalking.apm.util.PropertyPlaceholderHelper; @@ -57,15 +57,14 @@ public class ITApolloConfigurationTest { private final Yaml yaml = new Yaml(); private final String token = "f71f002a4ff9845639ef655ee7019759e31449de"; private final CloseableHttpClient httpClient = HttpClients.createDefault(); - private final ResponseHandler responseHandler = new BasicResponseHandler(); private String baseUrl; private ApolloConfigurationTestProvider provider; @Before public void setUp() throws Exception { - String host = System.getProperty("apollo.portal.host"); - String port = System.getProperty("apollo.portal.port"); + String host = "localhost"; // System.getProperty("apollo.portal.host"); + String port = "8070"; //System.getProperty("apollo.portal.port"); baseUrl = "http://" + host + ":" + port; LOGGER.info("baseUrl: {}", baseUrl); @@ -107,7 +106,7 @@ public void shouldReadUpdated() { " \"dataChangeCreatedBy\":\"apollo\"\n" + "}"); createConfigPost.setEntity(entity); - final String createResponse = (String) httpClient.execute(createConfigPost, responseHandler); + final CloseableHttpResponse createResponse = httpClient.execute(createConfigPost); LOGGER.info("createResponse: {}", createResponse); final HttpPost releaseConfigRequest = @@ -129,7 +128,7 @@ public void shouldReadUpdated() { ); releaseConfigRequest.setHeader("Authorization", token); releaseConfigRequest.setHeader("Content-Type", "application/json;charset=UTF-8"); - final String releaseCreateResponse = (String) httpClient.execute(releaseConfigRequest, responseHandler); + final CloseableHttpResponse releaseCreateResponse = httpClient.execute(releaseConfigRequest); LOGGER.info("releaseCreateResponse: {}", releaseCreateResponse); for (String v = provider.watcher.value(); v == null; v = provider.watcher.value()) { @@ -150,13 +149,17 @@ public void shouldReadUpdated() { deleteConfigRequest.setHeader("Authorization", token); deleteConfigRequest.setHeader("Content-Type", "application/json;charset=UTF-8"); httpClient.execute(deleteConfigRequest); - final String releaseDeleteResponse = (String) httpClient.execute(releaseConfigRequest, responseHandler); + final CloseableHttpResponse releaseDeleteResponse = httpClient.execute(releaseConfigRequest); LOGGER.info("releaseDeleteResponse: {}", releaseDeleteResponse); for (String v = provider.watcher.value(); v != null; v = provider.watcher.value()) { } assertNull(provider.watcher.value()); + } catch (HttpResponseException e) { + LOGGER.error(e.getMessage(), e); + LOGGER.error("status: {}", e.getStatusCode()); + fail(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage(), e); fail(e.getMessage()); @@ -226,7 +229,7 @@ public void cleanUp() throws IOException { ); releaseConfigRequest.setHeader("Authorization", token); releaseConfigRequest.setHeader("Content-Type", "application/json;charset=UTF-8"); - httpClient.execute(releaseConfigRequest, responseHandler); + httpClient.execute(releaseConfigRequest); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } diff --git a/oap-server/server-configuration/configuration-apollo/src/test/resources/application.yml b/oap-server/server-configuration/configuration-apollo/src/test/resources/application.yml index 6824cd7443a2..44f47a5d4cf5 100644 --- a/oap-server/server-configuration/configuration-apollo/src/test/resources/application.yml +++ b/oap-server/server-configuration/configuration-apollo/src/test/resources/application.yml @@ -21,7 +21,7 @@ test-module: configuration: apollo: - apolloMeta: http://${apollo.meta.host}:${apollo.meta.port} + apolloMeta: http://127.0.0.1:8080 #${apollo.meta.host}:${apollo.meta.port} apolloCluster: default apolloEnv: DEV appId: SampleApp