Maxwell-Guo commented on code in PR #3718: URL: https://github.com/apache/cassandra/pull/3718#discussion_r1875381671
########## test/unit/org/apache/cassandra/cql3/statements/DescribeStatementTest.java: ########## @@ -822,6 +823,61 @@ public void testDescribeWithCustomIndex() throws Throwable row(KEYSPACE_PER_TEST, "index", indexWithOptions, expectedIndexStmtWithOptions)); } + @Test + public void testDescribeCreateLikeTable() throws Throwable + { + requireNetwork(); + DatabaseDescriptor.setDynamicDataMaskingEnabled(true); + String souceTable = createTable(KEYSPACE_PER_TEST, + "CREATE TABLE %s (" + + " pk1 text, " + + " pk2 int MASKED WITH DEFAULT, " + + " ck1 int, " + + " ck2 double," + + " s1 float static, " + + " v1 int, " + + " v2 int, " + + "PRIMARY KEY ((pk1, pk2), ck1, ck2 ))"); + String targetTable = createTableLike("create table %s like %s", souceTable, KEYSPACE_PER_TEST, KEYSPACE_PER_TEST); + Pair<TableMetadata, TableMetadata> pair = assertTableMetaEquals(KEYSPACE_PER_TEST, KEYSPACE_PER_TEST, souceTable, targetTable); Review Comment: `assertTableMetaEquals` will aslo be used for other test classes like `CreateLikeTest -> testTableShemaCopy ()` 1. I remove the `getTableMetadata ` in CQLTester 2. I change the test code in DescribeStatementTest to ` ` TableMetadata source = getTableMetadata(KEYSPACE_PER_TEST, currentTable()); assertNotNull(source); String targetTable = createTableLike("create table %s like %s", souceTable, KEYSPACE_PER_TEST, KEYSPACE_PER_TEST); TableMetadata target = getTableMetadata(KEYSPACE_PER_TEST, currentTable()); assertNotNull(target); assertTrue(equalsWithoutTableNameAndDropCns(source, target)); assertNotEquals(source.id, target.id); assertNotEquals(source.name, target.name);` ` That is because `currentTableMetadata();` only return the table meta under KEYSPACE, and the `assertTableMetaEquals` is only used once, but it is used many time in `CreateLikeTest` so I move `assertTableMetaEquals ` to `CreateLikeTest`, WDYT ? @blerer ########## test/unit/org/apache/cassandra/cql3/statements/DescribeStatementTest.java: ########## @@ -822,6 +823,61 @@ public void testDescribeWithCustomIndex() throws Throwable row(KEYSPACE_PER_TEST, "index", indexWithOptions, expectedIndexStmtWithOptions)); } + @Test + public void testDescribeCreateLikeTable() throws Throwable + { + requireNetwork(); + DatabaseDescriptor.setDynamicDataMaskingEnabled(true); + String souceTable = createTable(KEYSPACE_PER_TEST, + "CREATE TABLE %s (" + + " pk1 text, " + + " pk2 int MASKED WITH DEFAULT, " + + " ck1 int, " + + " ck2 double," + + " s1 float static, " + + " v1 int, " + + " v2 int, " + + "PRIMARY KEY ((pk1, pk2), ck1, ck2 ))"); + String targetTable = createTableLike("create table %s like %s", souceTable, KEYSPACE_PER_TEST, KEYSPACE_PER_TEST); + Pair<TableMetadata, TableMetadata> pair = assertTableMetaEquals(KEYSPACE_PER_TEST, KEYSPACE_PER_TEST, souceTable, targetTable); Review Comment: `assertTableMetaEquals` will aslo be used for other test classes like `CreateLikeTest -> testTableShemaCopy ()` 1. I remove the `getTableMetadata ` in CQLTester 2. I change the test code in DescribeStatementTest to ` ` TableMetadata source = getTableMetadata(KEYSPACE_PER_TEST, currentTable()); assertNotNull(source); String targetTable = createTableLike("create table %s like %s", souceTable, KEYSPACE_PER_TEST, KEYSPACE_PER_TEST); TableMetadata target = getTableMetadata(KEYSPACE_PER_TEST, currentTable()); assertNotNull(target); assertTrue(equalsWithoutTableNameAndDropCns(source, target)); assertNotEquals(source.id, target.id); assertNotEquals(source.name, target.name);` ` That is because `currentTableMetadata();` only return the table meta under KEYSPACE, and the `assertTableMetaEquals` is only used once, but it is used many time in `CreateLikeTest` so I move `assertTableMetaEquals ` to `CreateLikeTest`, WDYT ? @blerer -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org