catalogtest

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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. The view tests are skipped for catalogs that do not implement catalog.ViewCatalog or whose view calls return iceberg.ErrNotImplemented.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

View Source
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

func RunCatalogTests(t *testing.T, cfg Config)

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. When it is false, as it is for the
	// Hadoop catalog, whose namespaces are directories with nowhere to keep
	// them, the tests that write properties are replaced by one asserting that
	// writing them returns iceberg.ErrNotImplemented and changes nothing.
	// Loading is required of every catalog and is tested either way.
	SupportsNamespaceProperties bool

	// SupportsRenameTable reports whether the catalog can rename tables.
	// When it is false, as it is for the Hadoop catalog until #1097 lands,
	// the rename tests are replaced by one asserting that RenameTable returns
	// iceberg.ErrNotImplemented and leaves the source table in place.
	SupportsRenameTable bool

	// SupportsNestedNamespaces reports whether the catalog follows Java's
	// nested namespace behavior: listing a namespace returns only its direct
	// children, and a namespace that still has children cannot be dropped.
	// When it is true, the suite checks both. It mirrors Java's
	// supportsNestedNamespaces, which is false by default. Unlike the other
	// flags it has no not-supported test: Hive and Glue reject nested
	// namespaces with their own error, not iceberg.ErrNotImplemented.
	SupportsNestedNamespaces bool
}

Config describes the catalog under test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL