tanmayrauth commented on code in PR #1285:
URL: https://github.com/apache/iceberg-go/pull/1285#discussion_r3464652258


##########
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:
   Since MemFS isn't BulkRemovableIO, these swallow tests pin the per-file 
Remove path but not the bulk DeleteFiles branch in PurgeFiles. PurgeTable's 
swallow-and-log is the same either way so I don't think it matters for *this* 
PR's goal — just flagging that the bulk path stays uncovered if that's 
something you'd want to lock in too (probably better as a PurgeFiles test than 
here). Up to you.



-- 
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]

Reply via email to