From dd52212aaf5fd037a26ca4e45a7413b3254a4873 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Fri, 21 Mar 2025 19:04:51 +0100 Subject: [PATCH 1/3] Rename namespace This makes it easier to track where the tables come from. --- catalog/rest/rest_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/rest/rest_integration_test.go b/catalog/rest/rest_integration_test.go index b68a32f08..9f1fa22da 100644 --- a/catalog/rest/rest_integration_test.go +++ b/catalog/rest/rest_integration_test.go @@ -42,7 +42,7 @@ type RestIntegrationSuite struct { cat *rest.Catalog } -const TestNamespaceIdent = "TEST NS" +const TestNamespaceIdent = "rest-integration-test" func (s *RestIntegrationSuite) loadCatalog(ctx context.Context) *rest.Catalog { cat, err := catalog.Load(ctx, "local", iceberg.Properties{ From 5208917aa85da41077505ace7d7eb8618b20ef96 Mon Sep 17 00:00:00 2001 From: Fokko Date: Fri, 21 Mar 2025 19:08:49 +0100 Subject: [PATCH 2/3] Slight refactor --- catalog/rest/rest_integration_test.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/catalog/rest/rest_integration_test.go b/catalog/rest/rest_integration_test.go index 9f1fa22da..74f7a3857 100644 --- a/catalog/rest/rest_integration_test.go +++ b/catalog/rest/rest_integration_test.go @@ -162,16 +162,13 @@ func (s *RestIntegrationSuite) TestUpdateNamespaceProps() { func (s *RestIntegrationSuite) TestCreateTable() { s.ensureNamespace() - const location = "s3://warehouse/iceberg" - tbl, err := s.cat.CreateTable(s.ctx, - catalog.ToIdentifier(TestNamespaceIdent, "test-table"), - tableSchemaSimple, catalog.WithProperties(iceberg.Properties{"foobar": "baz"}), - catalog.WithLocation(location)) + catalog.ToIdentifier(TestNamespaceIdent, "test-create-table"), + tableSchemaSimple, catalog.WithProperties(iceberg.Properties{"foobar": "baz"})) s.Require().NoError(err) s.Require().NotNil(tbl) - s.Equal(location, tbl.Location()) + s.Equal("s3://warehouse/rest-integration-test/test-create-table", tbl.Location()) s.Equal("baz", tbl.Properties()["foobar"]) exists, err := s.cat.CheckTableExists(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table")) @@ -184,11 +181,11 @@ func (s *RestIntegrationSuite) TestCreateTable() { func (s *RestIntegrationSuite) TestWriteCommitTable() { s.ensureNamespace() - const location = "s3://warehouse/iceberg" + const expected_location = "s3://warehouse/rest-integration-test/test-write-commit-table" tbl, err := s.cat.CreateTable(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table-2"), - tableSchemaNested, catalog.WithLocation(location)) + tableSchemaNested) s.Require().NoError(err) s.Require().NotNil(tbl) @@ -196,7 +193,7 @@ func (s *RestIntegrationSuite) TestWriteCommitTable() { s.Require().NoError(s.cat.DropTable(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table-2"))) }() - s.Equal(location, tbl.Location()) + s.Equal(expected_location, tbl.Location()) arrSchema, err := table.SchemaToArrowSchema(tableSchemaNested, nil, false, false) s.Require().NoError(err) @@ -217,7 +214,7 @@ func (s *RestIntegrationSuite) TestWriteCommitTable() { s.Require().NoError(err) defer table.Release() - pqfile, err := url.JoinPath(location, "data", "test_commit_table_data", "test.parquet") + pqfile, err := url.JoinPath(expected_location, "data", "test_commit_table_data", "test.parquet") s.Require().NoError(err) fw, err := tbl.FS().(io.WriteFileIO).Create(pqfile) From dae6202ef83f0e1ede0b5fca7b76e7e0d5741328 Mon Sep 17 00:00:00 2001 From: Fokko Date: Fri, 21 Mar 2025 19:10:02 +0100 Subject: [PATCH 3/3] Couldn't suppress the Pythonista --- catalog/rest/rest_integration_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/catalog/rest/rest_integration_test.go b/catalog/rest/rest_integration_test.go index 74f7a3857..4b6b592c9 100644 --- a/catalog/rest/rest_integration_test.go +++ b/catalog/rest/rest_integration_test.go @@ -181,7 +181,7 @@ func (s *RestIntegrationSuite) TestCreateTable() { func (s *RestIntegrationSuite) TestWriteCommitTable() { s.ensureNamespace() - const expected_location = "s3://warehouse/rest-integration-test/test-write-commit-table" + const expectedLocation = "s3://warehouse/rest-integration-test/test-write-commit-table" tbl, err := s.cat.CreateTable(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table-2"), @@ -193,7 +193,7 @@ func (s *RestIntegrationSuite) TestWriteCommitTable() { s.Require().NoError(s.cat.DropTable(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table-2"))) }() - s.Equal(expected_location, tbl.Location()) + s.Equal(expectedLocation, tbl.Location()) arrSchema, err := table.SchemaToArrowSchema(tableSchemaNested, nil, false, false) s.Require().NoError(err) @@ -214,7 +214,7 @@ func (s *RestIntegrationSuite) TestWriteCommitTable() { s.Require().NoError(err) defer table.Release() - pqfile, err := url.JoinPath(expected_location, "data", "test_commit_table_data", "test.parquet") + pqfile, err := url.JoinPath(expectedLocation, "data", "test_commit_table_data", "test.parquet") s.Require().NoError(err) fw, err := tbl.FS().(io.WriteFileIO).Create(pqfile)