diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f16cdb5c..d53c7e19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: image: mysql:8 env: # The MySQL docker container requires these environment variables to be set, so we can create and migrate the test database. - MYSQL_DATABASE: EVENTMESH_DASHBOARD + MYSQL_DATABASE: eventmesh_dashboard_test MYSQL_ROOT_PASSWORD: password ports: # https://docs.github.com/en/actions/using-containerized-services/about-service-containers diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java index f22bf74a..ab57fc11 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java @@ -34,7 +34,7 @@ public interface MetaMapper { @Select("SELECT * FROM meta WHERE id = #{id}") MetaEntity selectById(MetaEntity metaEntity); - @Select("SELECT * FROM meta WHERE cluster_id = #{clusterId}") + @Select("SELECT * FROM meta WHERE cluster_id = #{clusterId} LIMIT 1") MetaEntity selectByClusterId(MetaEntity metaEntity); @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml index f7062d76..d411315a 100644 --- a/eventmesh-dashboard-console/src/main/resources/application-dev.yml +++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml @@ -30,7 +30,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eventmesh-dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/eventmesh_dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true username: ${DB_USERNAME} password: ${DB_PASSWORD} diff --git a/eventmesh-dashboard-console/src/test/resources/application-test.yml b/eventmesh-dashboard-console/src/test/resources/application-test.yml index 1a903d3f..e959485b 100644 --- a/eventmesh-dashboard-console/src/test/resources/application-test.yml +++ b/eventmesh-dashboard-console/src/test/resources/application-test.yml @@ -21,9 +21,9 @@ spring: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eventmesh-dashboard-test?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true username: root - password: root + password: password initial-size: 1 max-active: 50 diff --git a/eventmesh-dashboard-console/src/test/resources/client-test.sql b/eventmesh-dashboard-console/src/test/resources/client-test.sql index 234a3c74..4a652f81 100644 --- a/eventmesh-dashboard-console/src/test/resources/client-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/client-test.sql @@ -16,12 +16,12 @@ */ DELETE -FROM `eventmesh-dashboard-test`.client +FROM `eventmesh_dashboard_test`.client WHERE TRUE; -ALTER TABLE `eventmesh-dashboard-test`.client +ALTER TABLE `eventmesh_dashboard_test`.client AUTO_INCREMENT = 1; -insert into `eventmesh-dashboard-test`.client (id, cluster_id, name, platform, language, pid, host, port, protocol, status, config_ids, description, +insert into `eventmesh_dashboard_test`.client (id, cluster_id, name, platform, language, pid, host, port, protocol, status, config_ids, description, create_time, end_time, update_time) values (1, 3, '', '', 'java', -1, '', -1, '', 1, '', '', '2024-02-02 15:15:15', '2024-02-02 15:15:15', '2024-02-02 15:15:15'), (2, 3, '', '', 'java', -1, '', -1, '', 1, '', '', '2024-02-02 15:15:15', '2024-02-02 15:15:15', '2024-02-02 15:15:15'), diff --git a/eventmesh-dashboard-console/src/test/resources/connection-test.sql b/eventmesh-dashboard-console/src/test/resources/connection-test.sql index 641ea5fa..361700a0 100644 --- a/eventmesh-dashboard-console/src/test/resources/connection-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/connection-test.sql @@ -15,10 +15,10 @@ * limitations under the License. */ -DELETE FROM `eventmesh-dashboard-test`.connection WHERE TRUE; -ALTER TABLE `eventmesh-dashboard-test`.connection AUTO_INCREMENT = 1; +DELETE FROM `eventmesh_dashboard_test`.connection WHERE TRUE; +ALTER TABLE `eventmesh_dashboard_test`.connection AUTO_INCREMENT = 1; -insert into `eventmesh-dashboard-test`.connection (id, cluster_id, source_type, source_id, sink_type, sink_id, runtime_id, status, topic, group_id, description, create_time, end_time, update_time) +insert into `eventmesh_dashboard_test`.connection (id, cluster_id, source_type, source_id, sink_type, sink_id, runtime_id, status, topic, group_id, description, create_time, end_time, update_time) values (1, 1, 'connector', 1, 'connector', 1, 1, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'), (2, 1, 'connector', 2, 'connector', 2, 2, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'), (3, 1, 'connector', 3, 'connector', 3, 3, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'), diff --git a/eventmesh-dashboard-console/src/test/resources/connector-test.sql b/eventmesh-dashboard-console/src/test/resources/connector-test.sql index 93403b6c..2ebdc5f5 100644 --- a/eventmesh-dashboard-console/src/test/resources/connector-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/connector-test.sql @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -DELETE FROM `eventmesh-dashboard-test`.connection WHERE TRUE; -ALTER TABLE `eventmesh-dashboard-test`.connection AUTO_INCREMENT = 1; +DELETE FROM `eventmesh_dashboard_test`.connection WHERE TRUE; +ALTER TABLE `eventmesh_dashboard_test`.connection AUTO_INCREMENT = 1; -insert into `eventmesh-dashboard-test`.connector (id, cluster_id, name, class_name, type, status, pod_state, config_ids, create_time, update_time) +insert into `eventmesh_dashboard_test`.connector (id, cluster_id, name, class_name, type, status, pod_state, config_ids, create_time, update_time) values (1, 1, '', 'the', '', 1, 1, '', '2024-02-02 16:43:45', '2024-02-02 16:53:02'), (2, 1, '', 'quick', '', 1, 1, '', '2024-02-02 16:43:45', '2024-02-02 16:53:02'), (3, 1, '', 'brown', '', 1, 2, '', '2024-02-02 16:43:45', '2024-02-02 16:53:02'), diff --git a/eventmesh-dashboard-console/src/test/resources/health-test.sql b/eventmesh-dashboard-console/src/test/resources/health-test.sql index 1c0b6a3e..45c3aebc 100644 --- a/eventmesh-dashboard-console/src/test/resources/health-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/health-test.sql @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -DELETE FROM `eventmesh-dashboard-test`.health_check_result WHERE TRUE; -ALTER TABLE `eventmesh-dashboard-test`.health_check_result AUTO_INCREMENT = 1; +DELETE FROM `eventmesh_dashboard_test`.health_check_result WHERE TRUE; +ALTER TABLE `eventmesh_dashboard_test`.health_check_result AUTO_INCREMENT = 1; -insert into `eventmesh-dashboard-test`.health_check_result (id, type, type_id, cluster_id, status, result_desc, create_time, update_time) +insert into `eventmesh_dashboard_test`.health_check_result (id, type, type_id, cluster_id, status, result_desc, create_time, update_time) values (1, 1, 1, 1, 0, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), (2, 2, 2, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), (3, 3, 3, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), diff --git a/eventmesh-dashboard-console/src/test/resources/meta-test.sql b/eventmesh-dashboard-console/src/test/resources/meta-test.sql index d169c735..66a63549 100644 --- a/eventmesh-dashboard-console/src/test/resources/meta-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/meta-test.sql @@ -15,9 +15,9 @@ * limitations under the License. */ -DELETE FROM `eventmesh-dashboard-test`.meta WHERE TRUE; -ALTER TABLE `eventmesh-dashboard-test`.meta AUTO_INCREMENT = 1; +DELETE FROM `eventmesh_dashboard_test`.meta WHERE TRUE; +ALTER TABLE `eventmesh_dashboard_test`.meta AUTO_INCREMENT = 1; -insert into `eventmesh-dashboard-test`.meta (id, name, type, version, cluster_id, host, port, role, username, params, status, create_time, update_time) +insert into `eventmesh_dashboard_test`.meta (id, name, type, version, cluster_id, host, port, role, username, params, status, create_time, update_time) values (1, '1', 'nacos', '1.0', 1, '', -1, '-1', '', '', 0, '2024-02-03 10:30:02', '2024-02-03 10:30:02'), (2, '2', 'zookeeper', '1.0', 1, '', -1, '-1', '', '', 0, '2024-02-03 10:30:02', '2024-02-03 10:30:02'); \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql b/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql index a23fc749..9006b5e2 100644 --- a/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql +++ b/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql @@ -15,4 +15,5 @@ * limitations under the License. */ -USE `eventmesh-dashboard-test` +CREATE DATABASE IF NOT EXISTS `eventmesh_dashboard_test`; +USE `eventmesh_dashboard_test`