* iceberg: implement stage-create and create-on-commit finalize * iceberg: add create validation error typing and stage-create integration test * tests: merge stage-create integration check into catalog suite * tests: cover stage-create finalize lifecycle in catalog integration * iceberg: persist and cleanup stage-create markers * iceberg: add stage-create rollout flag and marker pruning * docs: add stage-create support design and rollout plan * docs: drop stage-create design draft from PR * iceberg: use conservative 72h stage-marker retention * iceberg: address review comments on create-on-commit and tests * iceberg: keep stage-create metadata out of table location * refactor(iceberg): split iceberg.go into focused files
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package iceberg
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestValidateCreateTableRequestRequiresName(t *testing.T) {
|
|
err := validateCreateTableRequest(CreateTableRequest{})
|
|
if !errors.Is(err, errTableNameRequired) {
|
|
t.Fatalf("validateCreateTableRequest() error = %v, want errTableNameRequired", err)
|
|
}
|
|
}
|
|
|
|
func TestValidateCreateTableRequestAcceptsWithName(t *testing.T) {
|
|
err := validateCreateTableRequest(CreateTableRequest{Name: "orders"})
|
|
if err != nil {
|
|
t.Fatalf("validateCreateTableRequest() error = %v, want nil", err)
|
|
}
|
|
}
|
|
|
|
func TestIsStageCreateEnabledDefaultsToTrue(t *testing.T) {
|
|
t.Setenv("ICEBERG_ENABLE_STAGE_CREATE", "")
|
|
if !isStageCreateEnabled() {
|
|
t.Fatalf("isStageCreateEnabled() = false, want true")
|
|
}
|
|
}
|
|
|
|
func TestIsStageCreateEnabledFalseValues(t *testing.T) {
|
|
falseValues := []string{"0", "false", "FALSE", "no", "off"}
|
|
for _, value := range falseValues {
|
|
t.Setenv("ICEBERG_ENABLE_STAGE_CREATE", value)
|
|
if isStageCreateEnabled() {
|
|
t.Fatalf("isStageCreateEnabled() = true for value %q, want false", value)
|
|
}
|
|
}
|
|
}
|