Revanth14 commented on code in PR #1285:
URL: https://github.com/apache/iceberg-go/pull/1285#discussion_r3464748873
##########
catalog/hive/hive_test.go:
##########
@@ -523,6 +530,114 @@ func TestHiveDropTable(t *testing.T) {
mockClient.AssertExpectations(t)
}
+func TestHivePurgeTable(t *testing.T) {
+ assert := require.New(t)
+ ctx := context.Background()
+ tableLocation := filepath.Join(t.TempDir(), "warehouse",
"test_database", "test_table")
+ metadataLocation, dataFile := writeHivePurgeTableFiles(t, tableLocation)
+ hiveTable := hivePurgeTable(metadataLocation, tableLocation)
+
+ mockClient := &mockHiveClient{}
+ mockClient.On("GetTable", mock.Anything, "test_database", "test_table").
+ Return(hiveTable, nil).Twice()
+ mockClient.On("DropTable", mock.Anything, "test_database",
"test_table", false).
+ Return(nil).Once()
+
+ hiveCatalog := NewCatalogWithClient(mockClient, iceberg.Properties{})
+
+ assert.NoError(hiveCatalog.PurgeTable(ctx,
TableIdentifier("test_database", "test_table")))
+ assert.NoFileExists(metadataLocation)
+ assert.NoFileExists(dataFile)
+ mockClient.AssertExpectations(t)
+}
+
+func TestHivePurgeTableSwallowsPurgeFilesError(t *testing.T) {
+ assert := require.New(t)
+ ctx := context.Background()
+ const scheme = "hivepurgefail"
+ failingFS := failRemoveIO{MemFS: iceio.NewMemFS(), err:
errHivePurgeRemove}
+ iceio.Register(scheme, func(context.Context, *url.URL,
map[string]string) (iceio.IO, error) {
+ return failingFS, nil
Review Comment:
Thanks, agreed. These tests are focused on `PurgeTable` dropping the catalog
entry and swallowing/logging `PurgeFiles` failures, so the per-file remove path
is enough for this PR.
The `BulkRemovableIO` branch would be better covered directly in
`PurgeFiles` tests if we want to lock that behavior in separately.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]