6 changed files with 90 additions and 23 deletions
-
27weed/s3api/iceberg/iceberg.go
-
29weed/s3api/iceberg/iceberg_namespace_properties_test.go
-
3weed/s3api/s3tables/handler_namespace.go
-
24weed/s3api/s3tables/types.go
-
7weed/s3api/s3tables/utils.go
-
23weed/s3api/s3tables/utils_namespace_test.go
@ -0,0 +1,29 @@ |
|||
package iceberg |
|||
|
|||
import "testing" |
|||
|
|||
func TestNormalizeNamespacePropertiesNil(t *testing.T) { |
|||
properties := normalizeNamespaceProperties(nil) |
|||
if properties == nil { |
|||
t.Fatalf("normalizeNamespaceProperties(nil) returned nil map") |
|||
} |
|||
if len(properties) != 0 { |
|||
t.Fatalf("normalizeNamespaceProperties(nil) length = %d, want 0", len(properties)) |
|||
} |
|||
} |
|||
|
|||
func TestNormalizeNamespacePropertiesClonesInput(t *testing.T) { |
|||
input := map[string]string{ |
|||
"owner": "analytics", |
|||
} |
|||
|
|||
properties := normalizeNamespaceProperties(input) |
|||
if properties["owner"] != "analytics" { |
|||
t.Fatalf("normalized properties value = %q, want %q", properties["owner"], "analytics") |
|||
} |
|||
|
|||
input["owner"] = "mutated" |
|||
if properties["owner"] != "analytics" { |
|||
t.Fatalf("normalized properties was mutated via input map") |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue