shaofengshi closed pull request #410: Fix CI URL: https://github.com/apache/kylin/pull/410
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java b/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java index 40cb0a67f9..c07a997aaa 100644 --- a/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java +++ b/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java @@ -98,9 +98,10 @@ public void run() { return; } + fs.delete(tmpPath, true); + try (BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(fs.create(tmpPath, true), StandardCharsets.UTF_8))) { - fs.delete(tmpPath, true); bw.write(json); fs.setPermission(tmpPath, FsPermission.createImmutable((short) 0644)); } catch (IOException e) { diff --git a/examples/test_case_data/localmeta/kylin.properties b/examples/test_case_data/localmeta/kylin.properties index 434286e959..be2ecd4827 100644 --- a/examples/test_case_data/localmeta/kylin.properties +++ b/examples/test_case_data/localmeta/kylin.properties @@ -141,6 +141,7 @@ kylin.engine.mr.mem-hungry-config-override.test1=mem-test1 kylin.engine.mr.mem-hungry-config-override.test2=mem-test2 kylin.job.lock=org.apache.kylin.job.lock.MockJobLockDup kylin.job.lock=org.apache.kylin.job.lock.MockJobLock +kylin.env.zookeeper-connect-string=localhost:12181 diff --git a/pom.xml b/pom.xml index ac1edf0928..b20cc26250 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ <jamm.version>0.3.1</jamm.version> <mockito.version>2.7.14</mockito.version> <powermock.version>1.7.0</powermock.version> + <curator.version>2.7.1</curator.version> <!-- Commons --> <commons-lang3.version>3.4</commons-lang3.version> @@ -864,7 +865,12 @@ <artifactId>opensaml</artifactId> <version>${opensaml.version}</version> </dependency> - + <dependency> + <groupId>org.apache.curator</groupId> + <artifactId>curator-test</artifactId> + <version>${curator.version}</version> + <scope>test</scope> + </dependency> <!-- Spring Core --> <dependency> diff --git a/server/pom.xml b/server/pom.xml index b1365a70ef..84f54ca3c3 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -299,6 +299,11 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.curator</groupId> + <artifactId>curator-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java index cf8c2c12ee..ee5cbd1de0 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java +++ b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java @@ -18,8 +18,10 @@ package org.apache.kylin.rest.service; +import java.io.IOException; import java.util.Arrays; +import org.apache.curator.test.TestingServer; import org.apache.kylin.common.KylinConfig; import org.apache.kylin.common.util.LocalFileMetadataTestCase; import org.apache.kylin.metadata.cachesync.Broadcaster; @@ -50,6 +52,8 @@ @ActiveProfiles("testing") public class ServiceTestBase extends LocalFileMetadataTestCase { + private static TestingServer server; + @Autowired @Qualifier("userService") UserService userService; @@ -59,10 +63,14 @@ public static void setupResource() throws Exception { staticCreateTestMetadata(); Authentication authentication = new TestingAuthenticationToken("ADMIN", "ADMIN", Constant.ROLE_ADMIN); SecurityContextHolder.getContext().setAuthentication(authentication); + + server = new TestingServer(12181, true); + server.start(); } @AfterClass - public static void tearDownResource() { + public static void tearDownResource() throws IOException { + server.stop(); } @Before diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java index ae146d3966..b003ca2abd 100644 --- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java +++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java @@ -19,6 +19,8 @@ package org.apache.kylin.storage.hbase.util; import java.io.Closeable; +import java.io.File; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; @@ -297,7 +299,13 @@ private static String fixSlash(String path) { n = path.length(); path = path.replace("//", "/"); } - return path; + + try { + return new File(path).getCanonicalPath(); + } catch (IOException e) { + logger.error("get canonical path failed, use original path", e); + return path; + } } // ============================================================================ ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services