Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Apr 14, 2024
1 parent ab3ff36 commit 7c66a59
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class MetacatSmokeSpec extends Specification {
}

@Unroll
def "Test create/get iceberg table with nested fields with upper case"() {
def "Test create/get table with nested fields with upper case"() {
given:
def catalogName = 'embedded-fast-hive-metastore'
def databaseName = 'iceberg_db'
Expand Down Expand Up @@ -208,8 +208,10 @@ class MetacatSmokeSpec extends Specification {

def metadataLocation = String.format('/tmp/data/metadata/00000-0b60cc39-438f-413e-96c2-2694d7926529.metadata.json')

def metadata = [table_type: 'ICEBERG', metadata_location: metadataLocation]
tableDto.setMetadata(metadata)
if (isIcebergTable) {
def metadata = [table_type: 'ICEBERG', metadata_location: metadataLocation]
tableDto.setMetadata(metadata)
}
when:
try {api.createDatabase(catalogName, databaseName, new DatabaseCreateRequestDto())
} catch (Exception ignored) {
Expand All @@ -219,7 +221,9 @@ class MetacatSmokeSpec extends Specification {

then:
noExceptionThrown()
tableDTO.metadata.get("metadata_location").equals(metadataLocation)
if (isIcebergTable) {
tableDTO.metadata.get("metadata_location").equals(metadataLocation)
}
tableDTO.getFields().size() == 2
def nestedFieldDto = tableDTO.getFields().find { it.pos == 1 }
// assert that the type field also keeps the name fidelity
Expand Down Expand Up @@ -272,6 +276,10 @@ class MetacatSmokeSpec extends Specification {
JSONAssert.assertEquals(nestedFieldDto.jsonType.toString(), expectedJsonString, false)
cleanup:
api.deleteTable(catalogName, databaseName, tableName)
where:
isIcebergTable
true
false
}

@Unroll
Expand Down

0 comments on commit 7c66a59

Please sign in to comment.