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


##########
catalog/glue/glue_test.go:
##########
@@ -451,6 +459,116 @@ func TestGlueDropTable(t *testing.T) {
        assert.NoError(err)
 }
 
+func TestGluePurgeTable(t *testing.T) {
+       assert := require.New(t)
+       ctx := context.Background()
+       tableLocation := filepath.Join(t.TempDir(), "warehouse", 
"test_database", "test_table")
+       metadataLocation, dataFile := writeGluePurgeTableFiles(t, tableLocation)
+       glueTable := gluePurgeTable(metadataLocation)
+
+       mockGlueSvc := &mockGlueClient{}
+       mockGlueSvc.On("GetTable", mock.Anything, &glue.GetTableInput{
+               DatabaseName: aws.String("test_database"),
+               Name:         aws.String("test_table"),
+       }, mock.Anything).Return(&glue.GetTableOutput{Table: &glueTable}, 
nil).Twice()
+       mockGlueSvc.On("DeleteTable", mock.Anything, &glue.DeleteTableInput{
+               DatabaseName: aws.String("test_database"),
+               Name:         aws.String("test_table"),
+       }, mock.Anything).Return(&glue.DeleteTableOutput{}, nil).Once()
+
+       glueCatalog := &Catalog{glueSvc: mockGlueSvc}
+
+       assert.NoError(glueCatalog.PurgeTable(ctx, 
TableIdentifier("test_database", "test_table")))
+       assert.NoFileExists(metadataLocation)
+       assert.NoFileExists(dataFile)
+       mockGlueSvc.AssertExpectations(t)
+}
+
+func TestGluePurgeTableSwallowsPurgeFilesError(t *testing.T) {
+       assert := require.New(t)
+       ctx := context.Background()
+       const scheme = "gluepurgefail"
+       failingFS := failRemoveIO{MemFS: iceio.NewMemFS(), err: 
errGluePurgeRemove}
+       iceio.Register(scheme, func(context.Context, *url.URL, 
map[string]string) (iceio.IO, error) {

Review Comment:
   Addressed in both Glue and Hive. The tests now call 
`iceio.Unregister(scheme)` before `Register` to guard against stale 
registrations from a prior failed run, and still register cleanup with 
`t.Cleanup` for the normal path.



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