Browse Source

Add IT for dolphinscheduler-tools module (#15043)

3.2.1-prepare
Wenjun Ruan 1 year ago committed by GitHub
parent
commit
b750db3c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .github/workflows/unit-test.yml
  2. 27
      dolphinscheduler-bom/pom.xml
  3. 5
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/sql/ClasspathSqlScriptParser.java
  4. 6
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.0_schema/mysql/dolphinscheduler_ddl.sql
  5. 29
      dolphinscheduler-tools/pom.xml
  6. 30
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/BaseDolphinSchedulerManagerIT.java
  7. 81
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/BaseDolphinSchedulerDatabaseWithMysqlIT.java
  8. 39
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/DolphinSchedulerDatabaseInitializeWithMysqlIT.java
  9. 48
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/DolphinSchedulerDatabaseUpgradeWithMysqlIT.java
  10. 78
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/BaseDolphinSchedulerManagerWithPostgresqlIT.java
  11. 44
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/DolphinSchedulerDatabaseUpgradeWithPostgresqlIT.java
  12. 37
      dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/DolphinSchedulerInitializeWithPostgresqlIT.java
  13. 1939
      dolphinscheduler-tools/src/test/resources/3.0.0_schema/mysql_3.0.0.sql
  14. 1919
      dolphinscheduler-tools/src/test/resources/3.0.0_schema/postgresql_3.0.0.sql
  15. 43
      dolphinscheduler-tools/src/test/resources/application-mysql.yaml
  16. 43
      dolphinscheduler-tools/src/test/resources/application-postgresql.yaml
  17. 35
      dolphinscheduler-tools/src/test/resources/logback.xml
  18. 26
      pom.xml
  19. 1
      tools/dependencies/known-dependencies.txt

3
.github/workflows/unit-test.yml

@ -76,7 +76,7 @@ jobs:
restore-keys: ${{ runner.os }}-maven- restore-keys: ${{ runner.os }}-maven-
- name: Run Unit tests - name: Run Unit tests
run: ./mvnw clean verify -B -Dmaven.test.skip=false -Dspotless.skip=true run: ./mvnw clean verify -B -Dmaven.test.skip=false -Dspotless.skip=true -DskipUT=false -DskipIT=false
- name: Upload coverage report to codecov - name: Upload coverage report to codecov
run: CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash) run: CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
@ -99,6 +99,7 @@ jobs:
-Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682 -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
-Dsonar.exclusions=,dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/* -Dsonar.exclusions=,dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/*
-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-DskipUT=true -DskipIT=true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

27
dolphinscheduler-bom/pom.xml

@ -51,7 +51,7 @@
<httpcore.version>4.4.15</httpcore.version> <httpcore.version>4.4.15</httpcore.version>
<jackson.version>2.13.4</jackson.version> <jackson.version>2.13.4</jackson.version>
<protostuff.version>1.7.2</protostuff.version> <protostuff.version>1.7.2</protostuff.version>
<byte-buddy.version>1.9.16</byte-buddy.version> <byte-buddy.version>1.12.11</byte-buddy.version>
<logback.version>1.2.11</logback.version> <logback.version>1.2.11</logback.version>
<hadoop.version>3.2.4</hadoop.version> <hadoop.version>3.2.4</hadoop.version>
<cron-utils.version>9.1.6</cron-utils.version> <cron-utils.version>9.1.6</cron-utils.version>
@ -117,6 +117,8 @@
<protobuf.version>3.17.2</protobuf.version> <protobuf.version>3.17.2</protobuf.version>
<esdk-obs.version>3.23.3</esdk-obs.version> <esdk-obs.version>3.23.3</esdk-obs.version>
<system-lambda.version>1.2.1</system-lambda.version> <system-lambda.version>1.2.1</system-lambda.version>
<testcontainer.version>1.17.6</testcontainer.version>
<checker-qual.version>3.19.0</checker-qual.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -920,8 +922,31 @@
<version>${system-lambda.version}</version> <version>${system-lambda.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- test dependencies on TestContainers -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>${testcontainer.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>${testcontainer.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>${checker-qual.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<profiles> <profiles>
<profile> <profile>
<id>zk-3.8</id> <id>zk-3.8</id>

5
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/sql/ClasspathSqlScriptParser.java

@ -85,6 +85,9 @@ public class ClasspathSqlScriptParser implements SqlScriptParser {
if (trimLine.startsWith("delimiter")) { if (trimLine.startsWith("delimiter")) {
// begin to parse processor, until delimiter ; // begin to parse processor, until delimiter ;
String[] split = trimLine.split(" "); String[] split = trimLine.split(" ");
if (split[1].equals(";")) {
continue;
}
return parseProcedure(lineNumberReader, split[1]); return parseProcedure(lineNumberReader, split[1]);
} }
// begin to parse sql until; // begin to parse sql until;
@ -131,7 +134,7 @@ public class ClasspathSqlScriptParser implements SqlScriptParser {
if (StringUtils.isBlank(line)) { if (StringUtils.isBlank(line)) {
continue; continue;
} }
if (line.startsWith(delimiter)) { if (line.trim().startsWith(delimiter)) {
break; break;
} }
sqlLines.add(line); sqlLines.add(line);

6
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.0_schema/mysql/dolphinscheduler_ddl.sql

@ -91,8 +91,8 @@ BEGIN
ALTER TABLE t_ds_process_instance ADD COLUMN `next_process_instance_id` int(11) DEFAULT '0' COMMENT 'serial queue next processInstanceId'; ALTER TABLE t_ds_process_instance ADD COLUMN `next_process_instance_id` int(11) DEFAULT '0' COMMENT 'serial queue next processInstanceId';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL t_ds_process_instance_add_column; CALL t_ds_process_instance_add_column;
DROP PROCEDURE t_ds_process_instance_add_column; DROP PROCEDURE t_ds_process_instance_add_column;
@ -445,9 +445,7 @@ BEGIN
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='task_name') AND COLUMN_NAME ='task_name')
THEN THEN
ALTER TABLE `t_ds_fav_task` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT;
ALTER TABLE `t_ds_fav_task` DROP COLUMN `task_name`; ALTER TABLE `t_ds_fav_task` DROP COLUMN `task_name`;
ALTER TABLE `t_ds_fav_task` ADD COLUMN `task_type` varchar(64) NOT NULL COMMENT 'favorite task type name';
END IF; END IF;
END; END;
d// d//

29
dolphinscheduler-tools/pom.xml

@ -42,14 +42,17 @@
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-dao</artifactId> <artifactId>dolphinscheduler-dao</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-storage-all</artifactId> <artifactId>dolphinscheduler-storage-all</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-aop</artifactId> <artifactId>dolphinscheduler-aop</artifactId>
@ -116,6 +119,32 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- test dependencies on TestContainers -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

30
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/BaseDolphinSchedulerManagerIT.java

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource;
import org.apache.dolphinscheduler.dao.DaoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.testcontainers.containers.Network;
@SpringBootTest(classes = {UpgradeDolphinScheduler.class, DaoConfiguration.class})
public abstract class BaseDolphinSchedulerManagerIT {
protected static final Network NETWORK = Network.newNetwork();
}

81
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/BaseDolphinSchedulerDatabaseWithMysqlIT.java

@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.mysql;
import org.apache.dolphinscheduler.tools.datasource.BaseDolphinSchedulerManagerIT;
import org.apache.dolphinscheduler.tools.datasource.DolphinSchedulerManager;
import java.util.stream.Stream;
import javax.sql.DataSource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.lifecycle.Startables;
import org.testcontainers.utility.DockerImageName;
import com.google.common.collect.Lists;
// todo: use TestTemplate to test multiple mysql version
@Slf4j
@ActiveProfiles("mysql")
public class BaseDolphinSchedulerDatabaseWithMysqlIT extends BaseDolphinSchedulerManagerIT {
@Autowired
protected DolphinSchedulerManager dolphinSchedulerManager;
@Autowired
protected DataSource dataSource;
protected static GenericContainer databaseContainer;
@BeforeAll
public static void initializeContainer() {
// todo: test with multiple mysql version
databaseContainer = new MySQLContainer(DockerImageName.parse("mysql:8.0"))
.withUsername("root")
.withPassword("root")
.withDatabaseName("dolphinscheduler")
.withNetwork(NETWORK)
.withExposedPorts(3306)
.waitingFor(Wait.forHealthcheck());
databaseContainer.setPortBindings(Lists.newArrayList("3306:3306"));
log.info("Create MySQLContainer successfully.");
databaseContainer.start();
log.info("Starting MySQLContainer...");
Startables.deepStart(Stream.of(databaseContainer)).join();
log.info("MySQLContainer started");
}
@AfterAll
public static void closeContainer() {
if (databaseContainer != null) {
databaseContainer.stop();
}
}
}

39
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/DolphinSchedulerDatabaseInitializeWithMysqlIT.java

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.mysql;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.test.context.ActiveProfiles;
@Slf4j
@ActiveProfiles("mysql")
class DolphinSchedulerDatabaseInitializeWithMysqlIT extends BaseDolphinSchedulerDatabaseWithMysqlIT {
@Test
@DisplayName("Test Initialize DolphinScheduler database in MySQL")
void testInitializeWithMysqlProfile() {
Assertions.assertDoesNotThrow(() -> dolphinSchedulerManager.initDolphinScheduler());
// todo: Assert table count
}
}

48
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/mysql/DolphinSchedulerDatabaseUpgradeWithMysqlIT.java

@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.mysql;
import org.apache.dolphinscheduler.common.sql.SqlScriptRunner;
import java.io.IOException;
import java.sql.SQLException;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@Slf4j
class DolphinSchedulerDatabaseUpgradeWithMysqlIT extends BaseDolphinSchedulerDatabaseWithMysqlIT {
@Test
@DisplayName("Test Upgrade DolphinScheduler database in MySQL")
void testUpgradeWithMysqlProfile() throws SQLException, IOException {
// initialize the 3.0.0 schema
SqlScriptRunner sqlScriptRunner = new SqlScriptRunner(dataSource, "3.0.0_schema/mysql_3.0.0.sql");
sqlScriptRunner.execute();
log.info("Initialize the 3.0.0 schema successfully.");
Assertions.assertDoesNotThrow(() -> dolphinSchedulerManager.upgradeDolphinScheduler());
// todo: Assert table count
}
}

78
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/BaseDolphinSchedulerManagerWithPostgresqlIT.java

@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.postgresql;
import org.apache.dolphinscheduler.tools.datasource.BaseDolphinSchedulerManagerIT;
import org.apache.dolphinscheduler.tools.datasource.DolphinSchedulerManager;
import java.util.stream.Stream;
import javax.sql.DataSource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.lifecycle.Startables;
import org.testcontainers.utility.DockerImageName;
import com.google.common.collect.Lists;
// todo: use TestTemplate to test multiple PG version
@Slf4j
@ActiveProfiles("postgresql")
public class BaseDolphinSchedulerManagerWithPostgresqlIT extends BaseDolphinSchedulerManagerIT {
@Autowired
protected DolphinSchedulerManager dolphinSchedulerManager;
@Autowired
protected DataSource dataSource;
protected static GenericContainer databaseContainer;
@BeforeAll
public static void initializeContainer() {
// todo: test with multiple pg version
databaseContainer = new PostgreSQLContainer(DockerImageName.parse("postgres:11.1"))
.withUsername("root")
.withPassword("root")
.withDatabaseName("dolphinscheduler")
.withNetwork(NETWORK)
.withExposedPorts(5432);
databaseContainer.setPortBindings(Lists.newArrayList("5432:5432"));
log.info("Create PostgreSQLContainer successfully.");
databaseContainer.start();
log.info("Starting PostgreSQLContainer...");
Startables.deepStart(Stream.of(databaseContainer)).join();
log.info("PostgreSQLContainer started");
}
@AfterAll
public static void closeContainer() {
if (databaseContainer != null) {
databaseContainer.stop();
}
}
}

44
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/DolphinSchedulerDatabaseUpgradeWithPostgresqlIT.java

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.postgresql;
import org.apache.dolphinscheduler.common.sql.SqlScriptRunner;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@Slf4j
class DolphinSchedulerDatabaseUpgradeWithPostgresqlIT extends BaseDolphinSchedulerManagerWithPostgresqlIT {
@Test
@SneakyThrows
@DisplayName("Test Upgrade DolphinScheduler database in PostgreSQL")
void testUpgradeWithPostgreSQLProfile() {
// initialize the 3.0.0 schema
SqlScriptRunner sqlScriptRunner = new SqlScriptRunner(dataSource, "3.0.0_schema/postgresql_3.0.0.sql");
sqlScriptRunner.execute();
log.info("Initialize the 3.0.0 schema successfully.");
Assertions.assertDoesNotThrow(() -> dolphinSchedulerManager.upgradeDolphinScheduler());
// todo: Assert table count
}
}

37
dolphinscheduler-tools/src/test/java/org/apache/dolphinscheduler/tools/datasource/postgresql/DolphinSchedulerInitializeWithPostgresqlIT.java

@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.tools.datasource.postgresql;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@Slf4j
class DolphinSchedulerInitializeWithPostgresqlIT extends BaseDolphinSchedulerManagerWithPostgresqlIT {
@Test
@DisplayName("Test initDolphinScheduler database in PostgreSQL")
void testInitializeWithPostgreSQLProfile() {
Assertions.assertDoesNotThrow(() -> {
dolphinSchedulerManager.initDolphinScheduler();
});
// todo: Assert table count
}
}

1939
dolphinscheduler-tools/src/test/resources/3.0.0_schema/mysql_3.0.0.sql

File diff suppressed because it is too large Load Diff

1919
dolphinscheduler-tools/src/test/resources/3.0.0_schema/postgresql_3.0.0.sql

File diff suppressed because it is too large Load Diff

43
dolphinscheduler-tools/src/test/resources/application-mysql.yaml

@ -0,0 +1,43 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring:
main:
banner-mode: off
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
username: root
password: root
hikari:
connection-test-query: select 1
minimum-idle: 5
auto-commit: true
validation-timeout: 3000
pool-name: DolphinScheduler
maximum-pool-size: 50
connection-timeout: 30000
idle-timeout: 600000
leak-detection-threshold: 0
initialization-fail-timeout: 1
demo:
tenant-code: default
domain-name: localhost
api-server-port: 5173
# Override by profile

43
dolphinscheduler-tools/src/test/resources/application-postgresql.yaml

@ -0,0 +1,43 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring:
main:
banner-mode: off
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/dolphinscheduler
username: root
password: root
hikari:
connection-test-query: select 1
minimum-idle: 5
auto-commit: true
validation-timeout: 3000
pool-name: DolphinScheduler
maximum-pool-size: 50
connection-timeout: 30000
idle-timeout: 600000
leak-detection-threshold: 0
initialization-fail-timeout: 1
demo:
tenant-code: default
domain-name: localhost
api-server-port: 5173
# Override by profile

35
dolphinscheduler-tools/src/test/resources/logback.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<configuration scan="true" scanPeriod="120 seconds">
<property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS Z} %logger{96}:[%line] - [WorkflowInstance-%X{workflowInstanceId:-0}][TaskInstance-%X{taskInstanceId:-0}] - %msg%n
</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>

26
pom.xml

@ -73,6 +73,7 @@
<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version> <maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
<maven-source-plugin.version>2.4</maven-source-plugin.version> <maven-source-plugin.version>2.4</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0-M6</maven-surefire-plugin.version> <maven-surefire-plugin.version>3.0.0-M6</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M6</maven-failsafe-plugin.version>
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version> <maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
<maven-shade-plugin.version>3.2.1</maven-shade-plugin.version> <maven-shade-plugin.version>3.2.1</maven-shade-plugin.version>
<rpm-maven-plugion.version>2.2.0</rpm-maven-plugion.version> <rpm-maven-plugion.version>2.2.0</rpm-maven-plugion.version>
@ -95,6 +96,9 @@
<skipDepCheck>true</skipDepCheck> <skipDepCheck>true</skipDepCheck>
<build.ui.skip>false</build.ui.skip> <build.ui.skip>false</build.ui.skip>
<spotless.skip>false</spotless.skip> <spotless.skip>false</spotless.skip>
<skipUT>false</skipUT>
<skipIT>true</skipIT>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -590,12 +594,34 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version> <version>${maven-surefire-plugin.version}</version>
<configuration> <configuration>
<skip>${skipUT}</skip>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
<systemPropertyVariables> <systemPropertyVariables>
<jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile> <jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<skip>${skipIT}</skip>
<additionalClasspathElements>dolphinscheduler-dao/src/main/resources</additionalClasspathElements>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- jenkins plugin jacoco report--> <!-- jenkins plugin jacoco report-->
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>

1
tools/dependencies/known-dependencies.txt

@ -30,7 +30,6 @@ bcutil-jdk15on-1.69.jar
bonecp-0.8.0.RELEASE.jar bonecp-0.8.0.RELEASE.jar
bucket4j-core-6.2.0.jar bucket4j-core-6.2.0.jar
caffeine-2.9.3.jar caffeine-2.9.3.jar
checker-qual-3.12.0.jar
checker-qual-3.19.0.jar checker-qual-3.19.0.jar
classgraph-4.8.147.jar classgraph-4.8.147.jar
classmate-1.5.1.jar classmate-1.5.1.jar

Loading…
Cancel
Save