Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions catalog/rest/rest_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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"))
Expand All @@ -184,19 +181,19 @@ func (s *RestIntegrationSuite) TestCreateTable() {
func (s *RestIntegrationSuite) TestWriteCommitTable() {
s.ensureNamespace()

const location = "s3://warehouse/iceberg"
const expectedLocation = "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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the WithLocation option?

tableSchemaNested)
s.Require().NoError(err)
s.Require().NotNil(tbl)

defer func() {
s.Require().NoError(s.cat.DropTable(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, "test-table-2")))
}()

s.Equal(location, tbl.Location())
s.Equal(expectedLocation, tbl.Location())

arrSchema, err := table.SchemaToArrowSchema(tableSchemaNested, nil, false, false)
s.Require().NoError(err)
Expand All @@ -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(expectedLocation, "data", "test_commit_table_data", "test.parquet")
s.Require().NoError(err)

fw, err := tbl.FS().(io.WriteFileIO).Create(pqfile)
Expand Down
Loading