33import cn .hutool .http .HttpUtil ;
44import io .tapdata .common .CommonDbTest ;
55import io .tapdata .connector .doris .bean .DorisConfig ;
6- import io .tapdata .connector .doris .streamload .DorisStreamLoader ;
76import io .tapdata .kit .EmptyKit ;
8- import io .tapdata .kit .ErrorKit ;
97import io .tapdata .pdk .apis .entity .TestItem ;
10- import io .tapdata .pdk .apis .exception .testItem .TapTestConnectionEx ;
11- import io .tapdata .pdk .apis .exception .testItem .TapTestUnknownEx ;
12- import io .tapdata .pdk .apis .exception .testItem .TapTestVersionEx ;
13- import io .tapdata .pdk .apis .exception .testItem .TapTestWritePrivilegeEx ;
8+ import io .tapdata .pdk .apis .exception .testItem .*;
9+ import io .tapdata .util .NetUtil ;
1410import org .apache .http .client .methods .HttpGet ;
1511import org .apache .http .impl .client .CloseableHttpClient ;
1612import org .apache .http .util .EntityUtils ;
1713
14+ import java .io .IOException ;
1815import java .net .URI ;
1916import java .sql .Connection ;
2017import java .sql .SQLException ;
2320import java .util .Arrays ;
2421import java .util .List ;
2522import java .util .concurrent .atomic .AtomicInteger ;
23+ import java .util .concurrent .atomic .AtomicReference ;
2624import java .util .function .Consumer ;
2725
2826import static io .tapdata .base .ConnectorBase .testItem ;
@@ -71,6 +69,14 @@ protected Boolean testWritePrivilege() {
7169 jdbcContext .normalQuery ("show backends" , resultSet -> {
7270 while (resultSet .next ()) {
7371 beCount .incrementAndGet ();
72+ String beHost = (resultSet .getString ("Host" ));
73+ Integer httpPort = (resultSet .getInt ("HttpPort" ));
74+ if (null == beHost || null == httpPort ) continue ;
75+ try {
76+ NetUtil .validateHostPortWithSocket (beHost , httpPort );
77+ } catch (IOException e ) {
78+ throw new TapTestHostPortEx (e , beHost , String .valueOf (httpPort ));
79+ }
7480 }
7581 });
7682 } catch (SQLSyntaxErrorException e ) {
@@ -82,6 +88,9 @@ protected Boolean testWritePrivilege() {
8288 beCount .set (1 );
8389 }
8490 }
91+ } catch (TapTestHostPortEx e ) {
92+ consumer .accept (new TestItem (TestItem .ITEM_WRITE , TestItem .RESULT_FAILED , "Validate BE nodes failed: " + e .getMessage ()));
93+ return false ;
8594 }
8695
8796 List <String > sqls = new ArrayList <>();
0 commit comments