Documentation
¶
Overview ¶
Package test runs certificate manager tests against PostgreSQL in a container: the manager's own tests, and the tests of what's built on it.
Index ¶
- Constants
- func Begin(t *testing.T) (*manager.Manager, context.Context)
- func End(t *testing.T)
- func IsolatedManager(t *testing.T, opts ...manager.Opt) *manager.Manager
- func IsolatedSchema(t *testing.T) string
- func Main(m *testing.M, setup func(*manager.Manager) (func(), error), ...)
- func NewRoot(commonName, organization string) (*cert.Cert, string, error)
- func NewSchemaManager(schemaName string, opts ...manager.Opt) (*manager.Manager, error)
- func Pool() pg.PoolConn
- func Schema() string
- func SchemaManager(t *testing.T, schemaName string, opts ...manager.Opt) *manager.Manager
Constants ¶
const ( // PassphraseVersion and Passphrase are registered with the shared // manager, so that private keys can be encrypted PassphraseVersion = 1 Passphrase = "test passphrase" // RootCommonName and RootOrganization are the shared manager's root // certificate's subject RootCommonName = "Test Root CA" RootOrganization = "Test" )
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 ¶
IsolatedManager returns a new manager on a new, empty database schema, with only the options, so that a test sets its own passphrases and root, and can make assertions about every certificate. 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 managers on it with its own options. The schema is dropped when the test ends.
func Main ¶
Main is the test main function for certificate manager tests. It starts a PostgreSQL container, creates a manager on it, with the test passphrase and a new root certificate, 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 NewRoot ¶
NewRoot returns a new root certificate, valid for a day, and it with its private key, PEM encoded, as manager.WithRoot and InsertRootCert take it
func NewSchemaManager ¶
NewSchemaManager is SchemaManager, returning its error, for tests of the manager's options
Types ¶
This section is empty.