Documentation
¶
Overview ¶
Package testcontainer is how databricks' driver tests reach a workspace: through a tape (enginetest/tape) that replays a pinned workspace's answers, or, in a recording (OMNI_RECORD=1), through the workspace itself. A replay starts nothing and needs no credentials.
Databricks is an account service, so no container stands in for it. The tape sits at the Databricks SDK's HTTP transport: a request is its method, its route and its body, and an answer is its status, its content type and its body. The Authorization header is never recorded, and the host and token stay with the live client. A recording reads DATABRICKS_HOST and DATABRICKS_TOKEN from the environment; neither is written down.
An answer is narrowed to what the driver reads. Catalogs, schemas and tables keep their names and the table fields the sync maps; statement answers keep their columns, rows and state. Listings are sorted, and every value the service makes up that survives narrowing is replaced by the tape's stand-in: the statement ID, which names a later poll. Without that, two recordings of one workspace would not write the same bytes.
Index ¶
Constants ¶
const ( WarehouseID = "45847ad2fbd0b316" Catalog = "workspace" )
WarehouseID and Catalog are the SQL warehouse and catalog the tapes were recorded against, and the ones the pinned workspace's pin row names. The tests construct a driver with them instead of reading a DSN, so a replay needs no environment.
const Driver = "driver"
Driver is the pin row of the workspace the driver's tapes were recorded on.
Variables ¶
var Pins = func() string { _, file, _, _ := runtime.Caller(0) return filepath.Join(filepath.Dir(file), "..", "..", "testdata", "pins.tsv") }()
Pins is databricks/testdata/pins.tsv.
var Server = &tape.Server{Pins: Pins, Codec: codec{}}
Server is the tape server the driver's recordings are written to.
Functions ¶
func Open ¶
func Open(t testing.TB) *databricks.WorkspaceClient
Open returns t's workspace client: a replay of its tape, or, in a recording, the pinned workspace with every HTTP exchange written down. The client's token is a placeholder because the tape never reaches the service; the live transport reads the real host and token from the environment.
Types ¶
This section is empty.