This is an automated email from the ASF dual-hosted git repository.
yuluo-yx pushed a commit to branch 2.0.0
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/2.0.0 by this push:
new ad52459f8d chore: delete unuse test
ad52459f8d is described below
commit ad52459f8d523dc207f9e4f8ca118818c7466c6b
Author: yuluo-yx <[email protected]>
AuthorDate: Thu Jun 4 23:29:07 2026 +0800
chore: delete unuse test
Signed-off-by: yuluo-yx <[email protected]>
---
.../hertzbeat-collector-collector/pom.xml | 1 +
.../StartupMysqlR2dbcCompatibilityTest.java | 116 ---------------------
2 files changed, 1 insertion(+), 116 deletions(-)
diff --git a/hertzbeat-collector/hertzbeat-collector-collector/pom.xml
b/hertzbeat-collector/hertzbeat-collector-collector/pom.xml
index c5a73903e6..8a108c99de 100644
--- a/hertzbeat-collector/hertzbeat-collector-collector/pom.xml
+++ b/hertzbeat-collector/hertzbeat-collector-collector/pom.xml
@@ -41,6 +41,7 @@
<artifactId>hertzbeat-collector-basic</artifactId>
<version>${hertzbeat.version}</version>
</dependency>
+
<!-- collector-kafka -->
<dependency>
<groupId>org.apache.hertzbeat</groupId>
diff --git
a/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/StartupMysqlR2dbcCompatibilityTest.java
b/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/StartupMysqlR2dbcCompatibilityTest.java
deleted file mode 100644
index b93b6c934d..0000000000
---
a/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/StartupMysqlR2dbcCompatibilityTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.hertzbeat.startup;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-
-import java.time.Duration;
-import
org.apache.hertzbeat.collector.mysql.r2dbc.MysqlR2dbcConnectionFactoryProvider;
-import org.apache.hertzbeat.collector.mysql.r2dbc.MysqlR2dbcQueryExecutor;
-import org.apache.hertzbeat.collector.mysql.r2dbc.QueryOptions;
-import org.apache.hertzbeat.collector.mysql.r2dbc.QueryResult;
-import org.apache.hertzbeat.collector.mysql.r2dbc.ResultSetMapper;
-import org.apache.hertzbeat.collector.mysql.r2dbc.SqlGuard;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.utility.DockerImageName;
-
-/**
- * Verifies that the startup runtime can execute a real MySQL R2DBC query.
- */
-class StartupMysqlR2dbcCompatibilityTest {
-
- private static final String DATABASE = "hzb";
- private static final String USERNAME = "test";
- private static final String PASSWORD = "test123";
- private static final String ROOT_PASSWORD = "root123";
-
- private GenericContainer<?> container;
-
- @AfterEach
- void tearDown() {
- if (container != null) {
- container.stop();
- container = null;
- }
- }
-
- @Test
- void shouldExecuteMysqlQueryOnStartupRuntimeClasspath() throws Exception {
- container = new
GenericContainer<>(DockerImageName.parse("mysql:8.0.36"))
- .withExposedPorts(3306)
- .withEnv("MYSQL_DATABASE", DATABASE)
- .withEnv("MYSQL_USER", USERNAME)
- .withEnv("MYSQL_PASSWORD", PASSWORD)
- .withEnv("MYSQL_ROOT_PASSWORD", ROOT_PASSWORD)
- .waitingFor(Wait.forListeningPort());
- container.start();
- awaitTcpLoginReady();
-
- MysqlR2dbcQueryExecutor executor = new MysqlR2dbcQueryExecutor(
- new MysqlR2dbcConnectionFactoryProvider(),
- new ResultSetMapper(),
- new SqlGuard());
- QueryOptions options = QueryOptions.builder()
- .host(container.getHost())
- .port(container.getMappedPort(3306))
- .database(DATABASE)
- .username(USERNAME)
- .password(PASSWORD)
- .timeout(Duration.ofSeconds(8))
- .build();
-
- QueryResult result = executor.execute("SELECT 1 AS ok", options);
-
- assertFalse(result.hasError(), () -> "Unexpected query error: " +
result.getError());
- assertEquals(1, result.getRowCount());
- assertEquals("1", result.getRows().getFirst().getFirst());
- }
-
- private void awaitTcpLoginReady() throws Exception {
- long deadline = System.currentTimeMillis() + 30_000L;
- while (System.currentTimeMillis() < deadline) {
- try {
- var result = container.execInContainer("sh", "-lc",
- mysqlCliCommand("SELECT 1"));
- if (result.getExitCode() == 0) {
- return;
- }
- } catch (Exception ignored) {
- // Wait for the MySQL entrypoint to finish bootstrapping and
switch to the final TCP listener.
- }
- Thread.sleep(1000);
- }
- throw new IllegalStateException("Timed out waiting for MySQL TCP login
to become ready");
- }
-
- private String mysqlCliCommand(String sql) {
- return String.join(" ",
- "CLIENT=$(command -v mysql || command -v mariadb)",
- "&&",
- "$CLIENT --protocol=TCP -h127.0.0.1 -P3306",
- "-u" + USERNAME,
- "-p" + PASSWORD,
- DATABASE,
- "-e",
- "\"" + sql.replace("\"", "\\\"") + "\"");
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]