badalprasadsingh commented on code in PR #1211:
URL: https://github.com/apache/iceberg-go/pull/1211#discussion_r3428045879
##########
catalog/sql/sql_test.go:
##########
@@ -322,6 +322,28 @@ func (s *SqliteCatalogTestSuite)
TestCreationAllTablesExist() {
s.confirmTablesExist(sqldb)
}
+func (s *SqliteCatalogTestSuite) TestCatalogNameMatchesLoaderArg() {
+ const catalogName = "test_catalog"
+ cat, err := catalog.Load(context.Background(), catalogName,
iceberg.Properties{
+ "uri": ":memory:",
+ sqlcat.DriverKey: sqliteshim.ShimName,
+ sqlcat.DialectKey: string(sqlcat.SQLite),
+ "type": "sql",
+ "warehouse": "file://" + s.warehouse,
+ })
+ s.Require().NoError(err)
+ sqlCat := cat.(*sqlcat.Catalog)
+ s.Equal(catalogName, sqlCat.Name(), "SQL catalog must surface the name
passed to catalog.Load")
+
+ ctx := context.Background()
+ ns := table.Identifier{"test"}
+ s.Require().NoError(sqlCat.CreateNamespace(ctx, ns,
iceberg.Properties{"created_by": "iceberg-go"}))
+
+ got, err := sqlCat.ListNamespaces(ctx, table.Identifier{})
+ s.Require().NoError(err)
+ s.Contains(got, ns, "iceberg-go must list a namespace it just created
under its own catalog name")
Review Comment:
Done.
With one small substitution: I used a file-backed sqlite DB via
`s.catalogUri()` instead of `:memory:`, because two separate `:memory:` opens
give you isolated `DBs` and the cross-instance assertion would silently pass
for the wrong reason.
--
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]