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


##########
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) {
+               return failingFS, nil
+       })
+       t.Cleanup(func() { iceio.Unregister(scheme) })
+
+       tableLocation := scheme + "://bucket/test_database/test_table"
+       metadataLocation := tableLocation + "/metadata/v1.metadata.json"
+       dataFile := tableLocation + "/data/file.parquet"
+       writeGluePurgeTableMetadata(t, failingFS, tableLocation, 
metadataLocation)
+       require.NoError(t, failingFS.WriteFile(dataFile, []byte("data")))

Review Comment:
   Addressed. Switched the in-test `WriteFile` assertions to use the local 
`assert := require.New(t)` helper in both Glue and Hive.



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