|
16 | 16 |
|
17 | 17 | package com.alibaba.fluss.client.admin;
|
18 | 18 |
|
| 19 | +import com.alibaba.fluss.client.Connection; |
| 20 | +import com.alibaba.fluss.client.ConnectionFactory; |
19 | 21 | import com.alibaba.fluss.client.metadata.KvSnapshotMetadata;
|
20 | 22 | import com.alibaba.fluss.client.metadata.KvSnapshots;
|
21 | 23 | import com.alibaba.fluss.client.table.Table;
|
22 | 24 | import com.alibaba.fluss.client.table.writer.UpsertWriter;
|
23 | 25 | import com.alibaba.fluss.cluster.ServerNode;
|
24 | 26 | import com.alibaba.fluss.config.AutoPartitionTimeUnit;
|
25 | 27 | import com.alibaba.fluss.config.ConfigOptions;
|
| 28 | +import com.alibaba.fluss.config.Configuration; |
26 | 29 | import com.alibaba.fluss.exception.DatabaseAlreadyExistException;
|
27 | 30 | import com.alibaba.fluss.exception.DatabaseNotEmptyException;
|
28 | 31 | import com.alibaba.fluss.exception.DatabaseNotExistException;
|
@@ -742,6 +745,36 @@ tablePath, newPartitionSpec("pt", String.valueOf(currentYear + 1)), false)
|
742 | 745 | String.valueOf(currentYear)));
|
743 | 746 | }
|
744 | 747 |
|
| 748 | + @Test |
| 749 | + void testBootstrapServerConfigAsTabletServer() throws Exception { |
| 750 | + Configuration newConf = clientConf; |
| 751 | + ServerNode ts0 = FLUSS_CLUSTER_EXTENSION.getTabletServerNodes().get(0); |
| 752 | + newConf.set( |
| 753 | + ConfigOptions.BOOTSTRAP_SERVERS, |
| 754 | + Collections.singletonList(String.format("%s:%d", ts0.host(), ts0.port()))); |
| 755 | + try (Connection conn = ConnectionFactory.createConnection(clientConf)) { |
| 756 | + Admin newAdmin = conn.getAdmin(); |
| 757 | + String dbName = "test_bootstrap_server_t1"; |
| 758 | + newAdmin.createDatabase( |
| 759 | + dbName, |
| 760 | + DatabaseDescriptor.builder().comment("test comment").build(), |
| 761 | + false) |
| 762 | + .get(); |
| 763 | + newAdmin.createTable( |
| 764 | + TablePath.of(dbName, "test_table_1"), |
| 765 | + TableDescriptor.builder().schema(Schema.newBuilder().build()).build(), |
| 766 | + false) |
| 767 | + .get(); |
| 768 | + assertThat(newAdmin.getDatabaseInfo(dbName).get().getDatabaseName()).isEqualTo(dbName); |
| 769 | + assertThat( |
| 770 | + newAdmin.getTableInfo(TablePath.of(dbName, "test_table_1")) |
| 771 | + .get() |
| 772 | + .getTablePath() |
| 773 | + .getTableName()) |
| 774 | + .isEqualTo("test_table_1"); |
| 775 | + } |
| 776 | + } |
| 777 | + |
745 | 778 | private void assertHasTabletServerNumber(int tabletServerNumber) {
|
746 | 779 | CoordinatorGateway coordinatorGateway = FLUSS_CLUSTER_EXTENSION.newCoordinatorClient();
|
747 | 780 | retry(
|
|
0 commit comments