Documentation
¶
Overview ¶
Package catalogtest provides a conformance suite that every catalog.Catalog implementation can run against itself, so that shared behavior is specified once rather than re-derived in each implementation's tests. It mirrors the role of CatalogTests in the Java implementation.
An implementation opts in from its own test package by describing itself with a Config and calling RunCatalogTests:
func TestCatalogConformance(t *testing.T) {
catalogtest.RunCatalogTests(t, catalogtest.Config{
NewCatalog: func(t *testing.T) catalog.Catalog { ... },
})
}
Each test gets its own catalog from Config.NewCatalog, so tests never share state and may run in any order.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OtherSchema = iceberg.NewSchema(0, iceberg.NestedField{ID: 1, Name: "some_id", Type: iceberg.PrimitiveTypes.Int32, Required: true}, )
OtherSchema is a schema that is not Schema, used to check that a rejected create leaves the existing table alone.
var Schema = iceberg.NewSchema(0, iceberg.NestedField{ID: 3, Name: "id", Type: iceberg.PrimitiveTypes.Int32, Required: true, Doc: "unique ID 🤪"}, iceberg.NestedField{ID: 4, Name: "data", Type: iceberg.PrimitiveTypes.String, Required: true}, )
Schema is the schema the conformance tests create tables with. Its field IDs are deliberately not 1 and 2: catalogs assign fresh IDs on create, and TableSchema is what the created table is expected to report back.
var TableSchema = iceberg.NewSchema(0, iceberg.NestedField{ID: 1, Name: "id", Type: iceberg.PrimitiveTypes.Int32, Required: true, Doc: "unique ID 🤪"}, iceberg.NestedField{ID: 2, Name: "data", Type: iceberg.PrimitiveTypes.String, Required: true}, )
TableSchema is Schema with the fresh field IDs a catalog assigns on create.
Functions ¶
func RunCatalogTests ¶
RunCatalogTests runs the conformance suite against the catalog described by cfg. Each test runs as a subtest so a failure names the behavior that broke.
Types ¶
type Config ¶
type Config struct {
// NewCatalog returns a fresh, empty catalog for a single test. It is called
// once per test; implementations should register any teardown with
// t.Cleanup rather than relying on the suite to release resources.
NewCatalog func(t *testing.T) catalog.Catalog
// SupportsNamespaceProperties reports whether the catalog can store
// properties against a namespace. Tests that write properties are skipped
// when it is false, as they are for the Hadoop catalog, whose namespaces
// are directories with nowhere to keep them. Loading is required of every
// catalog and is tested either way.
SupportsNamespaceProperties bool
}
Config describes the catalog under test.