This is an automated email from the ASF dual-hosted git repository.
laskoviymishka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new 9cf331514 test(catalog/sql): encode warehouse paths as file URIs in
namespace tests (#2581)
9cf331514 is described below
commit 9cf33151459e2c56340240cff5fb022257ce1223
Author: Matt Topol <[email protected]>
AuthorDate: Mon Nov 16 10:17:15 2026 -0500
test(catalog/sql): encode warehouse paths as file URIs in namespace tests
(#2581)
newNamespaceRaceCatalog built its warehouse as "file://" + path. When two
subtests share a name, Go suffixes the second with "#01", and t.TempDir
keeps
that '#' in the directory name, so the warehouse URI gained a fragment. View
locations then resolved outside the test's temp dir, and TestRenameView's
duplicate "db.child" subtests failed whenever a previous run had left that
stray directory behind.
Build the URI with url.URL so the path is escaped, and give the
TestRenameView subtests distinct names.
Signed-off-by: Matt Topol <[email protected]>
---
catalog/sql/drop_namespace_internal_test.go | 6 +++++-
catalog/sql/rename_view_test.go | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/catalog/sql/drop_namespace_internal_test.go
b/catalog/sql/drop_namespace_internal_test.go
index b58ab4845..ce3a3137f 100644
--- a/catalog/sql/drop_namespace_internal_test.go
+++ b/catalog/sql/drop_namespace_internal_test.go
@@ -21,6 +21,7 @@ import (
"context"
dbsql "database/sql"
"errors"
+ "net/url"
"path/filepath"
"strings"
"sync"
@@ -93,9 +94,12 @@ func newNamespaceRaceCatalog(t *testing.T) *Catalog {
_, err = db.Exec("PRAGMA journal_mode=WAL")
require.NoError(t, err)
+ // Encode the path: subtest temp dirs can contain URI delimiters such as
+ // '#' (duplicate subtest names get a "#01" suffix), which a raw
+ // "file://" + path would turn into a fragment.
warehouse := filepath.Join(t.TempDir(), "warehouse")
cat, err := NewCatalog("default", db, SQLite, iceberg.Properties{
- "warehouse": "file://" + filepath.ToSlash(warehouse),
+ "warehouse": (&url.URL{Scheme: "file", Path:
filepath.ToSlash(warehouse)}).String(),
})
require.NoError(t, err)
diff --git a/catalog/sql/rename_view_test.go b/catalog/sql/rename_view_test.go
index e0171d76e..87b6b5009 100644
--- a/catalog/sql/rename_view_test.go
+++ b/catalog/sql/rename_view_test.go
@@ -73,7 +73,8 @@ func TestRenameViewCapability(t *testing.T) {
func TestRenameView(t *testing.T) {
for _, namespace := range []table.Identifier{{"db"}, {"other"}, {"db",
"child"}, {"db.child"}} {
- t.Run(strings.Join(namespace, "."), func(t *testing.T) {
+ // "|" keeps {"db", "child"} and {"db.child"} apart in subtest
names.
+ t.Run(strings.Join(namespace, "|"), func(t *testing.T) {
cat := newNamespaceRaceCatalog(t)
require.NoError(t, cat.CreateNamespace(t.Context(),
table.Identifier{"db"}, nil))
if !slices.Equal(namespace, table.Identifier{"db"}) {