Skip to content

Commit

Permalink
[#2864] test(web): Add test case of create kafka catalog (#2893)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Add test case of create kafka catalog

### Why are the changes needed?

Fix: #2864

### Does this PR introduce _any_ user-facing change?
N/A

### How was this patch tested?
<img width="814" alt="image"
src="https://github.com/datastrato/gravitino/assets/9210625/9d001b10-5f79-40ea-ba81-663ce3168117">
  • Loading branch information
LauraXia123 authored Apr 12, 2024
1 parent 2b32efe commit d3023dc
Showing 1 changed file with 37 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class CatalogsPageTest extends AbstractWebIT {
protected static String hdfsUri = "hdfs://127.0.0.1:9000";
protected static String mysqlUri = "jdbc:mysql://127.0.0.1";
protected static String postgresqlUri = "jdbc:postgresql://127.0.0.1";
protected static String kafkaUri = "http://127.0.0.1:9092";

private static final String WEB_TITLE = "Gravitino";
private static final String CATALOG_TABLE_TITLE = "Schemas";
Expand All @@ -60,6 +61,7 @@ public class CatalogsPageTest extends AbstractWebIT {
private static final String MODIFIED_CATALOG_NAME = HIVE_CATALOG_NAME + "_edited";
private static final String ICEBERG_CATALOG_NAME = "catalog_iceberg";
private static final String FILESET_CATALOG_NAME = "catalog_fileset";
private static final String KAFKA_CATALOG_NAME = "catalog_kafka";
private static final String SCHEMA_NAME = "default";
private static final String TABLE_NAME = "table1";
private static final String TABLE_NAME_2 = "table2";
Expand Down Expand Up @@ -233,6 +235,20 @@ public void testCreateFilesetCatalog() throws InterruptedException {

@Test
@Order(6)
public void testCreateKafkaCatalog() throws InterruptedException {
clickAndWait(catalogsPage.createCatalogBtn);
catalogsPage.setCatalogNameField(KAFKA_CATALOG_NAME);
clickAndWait(catalogsPage.catalogTypeSelector);
catalogsPage.clickSelectType("messaging");
catalogsPage.setCatalogCommentField("kafka catalog comment");
// set kafka catalog props
catalogsPage.setCatalogFixedProp("bootstrap.servers", kafkaUri);
clickAndWait(catalogsPage.handleSubmitCatalogBtn);
Assertions.assertTrue(catalogsPage.verifyGetCatalog(KAFKA_CATALOG_NAME));
}

@Test
@Order(7)
public void testRefreshPage() {
driver.navigate().refresh();
Assertions.assertEquals(driver.getTitle(), WEB_TITLE);
Expand All @@ -243,12 +259,13 @@ public void testRefreshPage() {
ICEBERG_CATALOG_NAME,
MYSQL_CATALOG_NAME,
PG_CATALOG_NAME,
FILESET_CATALOG_NAME);
FILESET_CATALOG_NAME,
KAFKA_CATALOG_NAME);
Assertions.assertTrue(catalogsPage.verifyCreatedCatalogs(catalogsNames));
}

@Test
@Order(7)
@Order(8)
public void testViewTabMetalakeDetails() throws InterruptedException {
clickAndWait(catalogsPage.tabDetailsBtn);
Assertions.assertTrue(catalogsPage.verifyShowDetailsContent());
Expand All @@ -257,15 +274,15 @@ public void testViewTabMetalakeDetails() throws InterruptedException {
}

@Test
@Order(8)
@Order(9)
public void testViewCatalogDetails() throws InterruptedException {
catalogsPage.clickViewCatalogBtn(HIVE_CATALOG_NAME);
Assertions.assertTrue(
catalogsPage.verifyShowCatalogDetails(HIVE_CATALOG_NAME, hiveMetastoreUri));
}

@Test
@Order(9)
@Order(10)
public void testEditCatalog() throws InterruptedException {
catalogsPage.clickEditCatalogBtn(HIVE_CATALOG_NAME);
catalogsPage.setCatalogNameField(MODIFIED_CATALOG_NAME);
Expand All @@ -275,7 +292,7 @@ public void testEditCatalog() throws InterruptedException {

// test catalog show schema list
@Test
@Order(10)
@Order(11)
public void testClickCatalogLink() {
catalogsPage.clickCatalogLink(METALAKE_NAME, MODIFIED_CATALOG_NAME, CATALOG_TYPE);
Assertions.assertTrue(catalogsPage.verifyShowTableTitle(CATALOG_TABLE_TITLE));
Expand All @@ -284,7 +301,7 @@ public void testClickCatalogLink() {
}

@Test
@Order(11)
@Order(12)
public void testRefreshCatalogPage() {
driver.navigate().refresh();
Assertions.assertEquals(driver.getTitle(), WEB_TITLE);
Expand All @@ -297,14 +314,15 @@ public void testRefreshCatalogPage() {
ICEBERG_CATALOG_NAME,
MYSQL_CATALOG_NAME,
PG_CATALOG_NAME,
FILESET_CATALOG_NAME);
FILESET_CATALOG_NAME,
KAFKA_CATALOG_NAME);
Assertions.assertTrue(catalogsPage.verifyTreeNodes(treeNodes));
Assertions.assertTrue(catalogsPage.verifySelectedNode(MODIFIED_CATALOG_NAME));
}

// test schema show table list
@Test
@Order(12)
@Order(13)
public void testClickSchemaLink() {
// create table
createTableAndColumn(
Expand All @@ -316,7 +334,7 @@ public void testClickSchemaLink() {
}

@Test
@Order(13)
@Order(14)
public void testRefreshSchemaPage() {
driver.navigate().refresh();
Assertions.assertEquals(driver.getTitle(), WEB_TITLE);
Expand All @@ -330,14 +348,15 @@ public void testRefreshSchemaPage() {
ICEBERG_CATALOG_NAME,
MYSQL_CATALOG_NAME,
PG_CATALOG_NAME,
FILESET_CATALOG_NAME);
FILESET_CATALOG_NAME,
KAFKA_CATALOG_NAME);
Assertions.assertTrue(catalogsPage.verifyTreeNodes(treeNodes));
Assertions.assertTrue(catalogsPage.verifySelectedNode(SCHEMA_NAME));
}

// test table show column list
@Test
@Order(14)
@Order(15)
public void testClickTableLink() {
catalogsPage.clickTableLink(
METALAKE_NAME, MODIFIED_CATALOG_NAME, CATALOG_TYPE, SCHEMA_NAME, TABLE_NAME);
Expand All @@ -348,7 +367,7 @@ public void testClickTableLink() {
}

@Test
@Order(15)
@Order(16)
public void testRefreshTablePage() {
driver.navigate().refresh();
Assertions.assertEquals(driver.getTitle(), WEB_TITLE);
Expand All @@ -364,12 +383,13 @@ public void testRefreshTablePage() {
ICEBERG_CATALOG_NAME,
MYSQL_CATALOG_NAME,
PG_CATALOG_NAME,
FILESET_CATALOG_NAME);
FILESET_CATALOG_NAME,
KAFKA_CATALOG_NAME);
Assertions.assertTrue(catalogsPage.verifyTreeNodes(treeNodes));
}

@Test
@Order(16)
@Order(17)
public void testSelectMetalake() throws InterruptedException {
catalogsPage.metalakeSelectChange(METALAKE_SELECT_NAME);
Assertions.assertTrue(catalogsPage.verifyEmptyCatalog());
Expand All @@ -379,7 +399,7 @@ public void testSelectMetalake() throws InterruptedException {
}

@Test
@Order(17)
@Order(18)
public void testClickTreeList() throws InterruptedException {
String icebergNode =
String.format("{{%s}}{{%s}}{{%s}}", METALAKE_NAME, ICEBERG_CATALOG_NAME, CATALOG_TYPE);
Expand Down Expand Up @@ -420,7 +440,7 @@ public void testClickTreeList() throws InterruptedException {
}

@Test
@Order(18)
@Order(19)
public void testTreeNodeRefresh() throws InterruptedException {
createTableAndColumn(
METALAKE_NAME, MODIFIED_CATALOG_NAME, SCHEMA_NAME, TABLE_NAME_2, COLUMN_NAME_2);
Expand All @@ -443,7 +463,7 @@ public void testTreeNodeRefresh() throws InterruptedException {
}

@Test
@Order(19)
@Order(20)
public void testBackHomePage() throws InterruptedException {
clickAndWait(catalogsPage.backHomeBtn);
Assertions.assertTrue(catalogsPage.verifyBackHomePage());
Expand Down

0 comments on commit d3023dc

Please sign in to comment.