diff --git a/.travis.yml b/.travis.yml index a49a049b17a95b002011fb2e4264a4aa5d410a28..09d93a8d5302e7442e22f21de2d5dc9bf35d8977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,9 @@ os: - linux jdk: - - oraclejdk8 - openjdk8 language: java install: - - ./mvnw org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report --quiet - - ./mvnw javadoc:javadoc -Dmaven.test.skip=true --quiet + - ./mvnw -DskipTests clean install --quiet diff --git a/Jenkinsfile b/Jenkinsfile index 255dfb93823e07cda39a16790bd1bdd8c142782c..6eaad7b078439c1d36513f6c0fc88354af81c238 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,57 +17,63 @@ */ pipeline { - agent { - label 'ubuntu' - } - - tools { - jdk 'JDK 1.8 (latest)' - } + agent none options { buildDiscarder(logRotator( - numToKeepStr: '30', + numToKeepStr: '60', )) timestamps() skipStagesAfterUnstable() - timeout time: 30, unit: 'MINUTES' + timeout time: 60, unit: 'MINUTES' } stages { - stage('SCM Checkout') { - steps { - deleteDir() - checkout scm - } - } + stage('Install & Test') { + parallel { + stage('JDK 1.8 on Linux') { + agent { + label 'xenial' + } - stage('Check environment') { - steps { - sh 'env' - sh 'pwd' - sh 'ls' - sh 'git status' - } - } + tools { + jdk 'JDK 1.8 (latest)' + } - stage('Run install') { - steps { - sh './mvnw org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report --quiet --batch-mode -nsu' - } - } + stages { + stage('SCM Checkout') { + steps { + deleteDir() + checkout scm + sh 'git submodule update --init' + } + } - stage('Run install') { - steps { - sh './mvnw javadoc:javadoc -Dmaven.test.skip=true --quiet' - } - } - } + stage('Check environment') { + steps { + sh 'env' + sh 'pwd' + sh 'ls' + sh 'git status' + } + } + + stage('Test & Report') { + steps { + sh './mvnw -P"agent,backend,ui,dist,CI-with-IT" org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report' + sh './mvnw javadoc:javadoc -Dmaven.test.skip=true' + } + } + } - post { - always { - junit '**/target/surefire-reports/*.xml' - deleteDir() + post { + always { + junit '**/target/surefire-reports/*.xml' + deleteDir() + } + } + } + } } } -} \ No newline at end of file +} diff --git a/oap-server/pom.xml b/oap-server/pom.xml index 6a1ea521bb7e59dc6ddf38e7179b3f83b17c9334..104ae92db1c085abe07f48002244570be2f548cf 100644 --- a/oap-server/pom.xml +++ b/oap-server/pom.xml @@ -388,18 +388,6 @@ - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - diff --git a/oap-server/server-configuration/configuration-nacos/pom.xml b/oap-server/server-configuration/configuration-nacos/pom.xml index 207ed8f2d43e718b3f538a2a032125eb764eef7a..67d1943261d7e125c7964471535665b1f3bbabbb 100644 --- a/oap-server/server-configuration/configuration-nacos/pom.xml +++ b/oap-server/server-configuration/configuration-nacos/pom.xml @@ -45,4 +45,147 @@ nacos-client + + + + CI-with-IT + + + + io.fabric8 + docker-maven-plugin + + all + true + default + true + IfNotPresent + true + + + mysql:5.7 + nacos-dynamic-configuration-integration-test-mysql + + + test-network + mysql + + + 127.0.0.1 + yes + + none + + mysql.port:3306 + + + + + src/test/resources/docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d + + + + + ready for connections + + + + + + nacos/nacos-server:${nacos.version} + nacos-dynamic-configuration-integration-test-nacos + + + test-network + nacos + + + standalone + mysql + test + ${mysql.port} + + none + + nacos-dynamic-configuration-integration-test-mysql + + + nacos-dynamic-configuration-integration-test-mysql + + + nacos.port:8848 + + + Nacos started successfully + + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + org.codehaus.gmaven + gmaven-plugin + ${gmaven-plugin.version} + + + add-default-properties + initialize + + execute + + + 2.0 + + project.properties.setProperty('docker.hostname', 'localhost') + + log.info("Docker hostname is " + project.properties['docker.hostname']) + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + ${docker.hostname} + + + ${nacos.port} + + + + + + + integration-test + verify + + + + + + + + diff --git a/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java b/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java index 74ecb4dfa5dd61c2f80cfab6f4b88b848dc1645e..bcc353b2fc37b5f7ac4ed52694f5a3441de8f10b 100644 --- a/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java +++ b/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java @@ -24,6 +24,8 @@ import org.apache.skywalking.oap.server.configuration.api.AbstractConfigurationP import org.apache.skywalking.oap.server.configuration.api.ConfigWatcherRegister; import org.apache.skywalking.oap.server.library.module.ModuleConfig; import org.apache.skywalking.oap.server.library.module.ModuleStartException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Get configuration from Nacos. @@ -31,6 +33,8 @@ import org.apache.skywalking.oap.server.library.module.ModuleStartException; * @author kezhenxu94 */ public class NacosConfigurationProvider extends AbstractConfigurationProvider { + private static final Logger LOGGER = LoggerFactory.getLogger(NacosConfigurationProvider.class); + private NacosServerSettings settings; public NacosConfigurationProvider() { @@ -49,6 +53,7 @@ public class NacosConfigurationProvider extends AbstractConfigurationProvider { @Override protected ConfigWatcherRegister initConfigReader() throws ModuleStartException { + LOGGER.info("settings: {}", settings); if (Strings.isNullOrEmpty(settings.getServerAddr())) { throw new ModuleStartException("Nacos serverAddr cannot be null or empty."); } diff --git a/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java b/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java index cab899180d0c007fa71e37e13fded529e3c3c465..1e9d1a0812b41058062fbadc8c7f36d9754b51dd 100644 --- a/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java +++ b/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java @@ -27,8 +27,9 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.library.util.CollectionUtils; import org.apache.skywalking.oap.server.library.util.ResourceUtils; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; import java.io.FileNotFoundException; @@ -36,12 +37,17 @@ import java.io.Reader; import java.util.Map; import java.util.Properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; /** * @author kezhenxu94 */ public class ITNacosConfigurationTest { + private static final Logger LOGGER = LoggerFactory.getLogger(ITNacosConfigurationTest.class); + private final Yaml yaml = new Yaml(); private NacosConfigurationTestProvider provider; @@ -63,13 +69,16 @@ public class ITNacosConfigurationTest { } @SuppressWarnings("StatementWithEmptyBody") - @Ignore // because of instability - @Test(timeout = 10000) + @Test(timeout = 20000) public void shouldReadUpdated() throws NacosException { assertNull(provider.watcher.value()); final Properties properties = new Properties(); - properties.put("serverAddr", "localhost:8848"); + final String nacosHost = System.getProperty("nacos.host"); + final String nacosPort = System.getProperty("nacos.port"); + LOGGER.info("nacosHost: {}, nacosPort: {}", nacosHost, nacosPort); + properties.put("serverAddr", nacosHost + ":" + nacosPort); + final ConfigService configService = NacosFactory.createConfigService(properties); assertTrue(configService.publishConfig("test-module.default.testKey", "skywalking", "500")); diff --git a/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml b/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml index fd6a07084dcf4cda9599d960db337e5a9f3aff46..fb9624de5ec180c739e3ac7ba1f852968ef00ca5 100644 --- a/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml +++ b/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml @@ -22,9 +22,9 @@ test-module: configuration: nacos: # Nacos Server Host - serverAddr: localhost + serverAddr: ${nacos.host} # Nacos Server Port - port: 8848 + port: ${nacos.port} # Nacos Configuration Group group: 'skywalking' # Unit seconds, sync period. Default fetch every 60 seconds. diff --git a/oap-server/server-library/library-client/pom.xml b/oap-server/server-library/library-client/pom.xml index ed426d87fd3ea6482b5492283a4c638061c3a413..c5b0e26f943e6febd8f754c2bc2133b3c799bc47 100644 --- a/oap-server/server-library/library-client/pom.xml +++ b/oap-server/server-library/library-client/pom.xml @@ -17,7 +17,9 @@ ~ --> - + server-library org.apache.skywalking @@ -55,51 +57,98 @@ - - - - io.fabric8 - docker-maven-plugin - - all - default - true - IfNotPresent - - - - prepare-elasticsearch - pre-integration-test - - start - + + + CI-with-IT + + + + io.fabric8 + docker-maven-plugin - - - elastic/elasticsearch:${elasticsearch.version} - elastic-client-integration-test - - - 9200:9200 - - - started - - - - - + all + default + true + IfNotPresent - - - remove-it-database - post-integration-test - - stop - - - - - - - \ No newline at end of file + + + prepare-elasticsearch + pre-integration-test + + start + + + + + elastic/elasticsearch:${elasticsearch.version} + elastic-client-integration-test + + + es-port:9200 + + + started + + + + single-node + + + + + + + + remove-it-database + post-integration-test + + stop + + + + + + org.codehaus.gmaven + gmaven-plugin + ${gmaven-plugin.version} + + + add-default-properties + initialize + + execute + + + 2.0 + + project.properties.setProperty('docker.hostname', 'localhost') + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + ${docker.hostname}:${es-port} + + + + + + + integration-test + verify + + + + + + + + + diff --git a/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java b/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java index 3ba3b03f25a1e83be347f324be45d76adefc4da1..f2f6d2884fc58ca12915717fd1c95de3ef9682b7 100644 --- a/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java +++ b/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java @@ -19,18 +19,25 @@ package org.apache.skywalking.oap.server.library.client.elasticsearch; import com.google.gson.JsonObject; -import java.io.IOException; -import java.util.*; -import java.util.concurrent.TimeUnit; import org.elasticsearch.action.bulk.BulkProcessor; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.xcontent.*; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.junit.*; -import org.slf4j.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; /** * @author peng-yongsheng @@ -43,7 +50,8 @@ public class ITElasticSearchClient { @Before public void before() throws IOException { - client = new ElasticSearchClient("localhost:9200", "", "test", "test"); + final String esAddress = System.getProperty("elastic.search.address"); + client = new ElasticSearchClient(esAddress, "", "test", "test"); client.connect(); } diff --git a/pom.xml b/pom.xml index a4dce435cec35595dee984e31b071fa965ddd711..a6dc5a38b5ac39ca318e1c54bfa68ab660291477 100644 --- a/pom.xml +++ b/pom.xml @@ -155,6 +155,28 @@ + + CI-with-IT + + false + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + @@ -186,6 +208,7 @@ 3.0.0 0.8.3 1.21 + 1.5 @@ -306,7 +329,7 @@ - [1.8,9) + 1.8