wuzhim commented on a change in pull request #1811:
URL: https://github.com/apache/kylin/pull/1811#discussion_r803544739
##########
File path:
core-common/src/test/java/org/apache/kylin/common/util/ParameterFilterTest.java
##########
@@ -41,24 +42,37 @@
{"db and 1=2", "dband12"}
};
+ private String[] sparkConf = {"kylin.engine.spark-conf.'`touch
/tmp/test`'", "'$(touch /tmp/test)'"};
+
@Test
- public void testCmd() {
+ public void testParameter() {
for (String[] pair : commands) {
- assertEquals(pair[1], CliCommandExecutor.checkParameter(pair[0]));
+ assertEquals(pair[1], ParameterFilter.checkParameter(pair[0]));
}
}
@Test
- public void testCmd2() {
+ public void testURI() {
for (String[] pair : commands) {
- assertEquals(pair[1],
CliCommandExecutor.checkParameterWhiteList(pair[0]));
+ assertEquals(pair[1], ParameterFilter.checkURI(pair[0]));
}
}
@Test
public void testHiveProperties() {
for (String[] pair : properties) {
- assertEquals(pair[1],
CliCommandExecutor.checkHiveProperty(pair[0]));
+ assertEquals(pair[1], ParameterFilter.checkHiveProperty(pair[0]));
+ }
+ }
+
+ @Test
+ public void testSparkConf() {
+ for(String conf : sparkConf) {
+ try {
+ ParameterFilter.checkSparkConf(conf);
+ } catch (Exception exception) {
+ Assert.assertTrue(exception instanceof
IllegalArgumentException);
Review comment:
这里上面代码中不抛异常这个 UT 也是过的,方法是不是可以改成 @Test(expected =
IllegalArgumentException.class)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]