Documentation
¶
Index ¶
- Constants
- func Begin(t *testing.T) (*credential.Manager, context.Context)
- func End(t *testing.T)
- func IsolatedManager(t *testing.T, opts ...credential.Opt) *credential.Manager
- func IsolatedSchema(t *testing.T) string
- func Main(m *testing.M, setup func(*credential.Manager) (func(), error), ...)
- func Pool() pg.PoolConn
- func Schema() string
- func SchemaManager(t *testing.T, schemaName string, opts ...credential.Opt) *credential.Manager
Constants ¶
const ( // PassphraseVersion and Passphrase are registered with every test manager, // so that credentials can be encrypted PassphraseVersion = 1 Passphrase = "test passphrase" )
Variables ¶
This section is empty.
Functions ¶
func Begin ¶
Begin returns the shared test manager and a per-test context, which is cancelled when the test ends.
func IsolatedManager ¶
func IsolatedManager(t *testing.T, opts ...credential.Opt) *credential.Manager
IsolatedManager returns a new manager on a new, empty database schema, so that a test can make assertions about every credential, which it cannot do with the shared manager as other tests also create credentials. The schema is dropped when the test ends.
func IsolatedSchema ¶
IsolatedSchema returns the name of a new, empty database schema, so that a test can create several managers on it with different options. The schema is dropped when the test ends.
func Main ¶
func Main(m *testing.M, setup func(*credential.Manager) (func(), error), opts ...credential.Opt)
Main is the test main function for credential manager tests. It starts a PostgreSQL container, creates a manager on it, with the test passphrase, and runs the tests, which get the manager with Begin. The setup function, when it's set, is called with the manager before the tests run, and the teardown it returns after.
func Pool ¶
Pool returns the shared test connection pool, such as for a connection of a test's own, which the manager can act on
func Schema ¶
func Schema() string
Schema returns the database schema used by the shared test manager, for tests which need to refer to its tables directly
func SchemaManager ¶
func SchemaManager(t *testing.T, schemaName string, opts ...credential.Opt) *credential.Manager
SchemaManager returns a new manager on the schema, with the test passphrase and the options. The manager isn't closed, as it shares the pool with the other managers.
Types ¶
This section is empty.