pgstandin

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package pgstandin gives the tests of this module a PostgreSQL database that has no server: a real *dalgo2postgres.Database whose connection pool lost its server, so that every call that needs a connection fails the way a read fails when the server was restarted, the password was changed or the connection limit was reached: with the error pgx writes, which names the user and holds the whole configuration. A test of a command, a route or a chat puts it behind the opener of PostgreSQL databases and looks for a marker in the user name and the password in everything the code under test printed, answered or logged.

Nothing is dialled: the one connection the database is opened with runs over an in-memory pipe against a few lines of the protocol, and every later dial fails. Test code only: nothing in this module's binaries imports it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unreachable

func Unreachable(tb testing.TB, user, password string, keyedTables ...string) *dalgo2postgres.Database

Unreachable opens a *dalgo2postgres.Database as the user, with the password, against an in-memory server that answers the one connection the adapter verifies the source with, and then goes away for good. It uses the exact identifier mode, as BackendRef does, and declares no recordset, as BackendRef does; a test of a call that reads or writes a record by its key names the tables it needs declared (each keyed by a column "id"), because without a declaration those calls fail before they reach a connection. The database is closed when the test ends.

Types

This section is empty.

Jump to

Keyboard shortcuts

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