// Package postgres implements an f2 extension for working with PostgreSQL databases // // For L1 tests an embedded-postgres binary is started, while for L2 tests an // external PostgreSQL cluster with a configured database is expected to be // running and connection details passed to the test binary. Required flags can // be discovered by running the example test using the --help argument, and // searching for `postgres` // // rosa //test/f2/examples/pgtest/... --test_arg=--help // // Test isolation is achieved by creating a new unique schema within the database // for each test. Test authors should ensure tests only modify data within the // configured schema. Helper methods have been created to ensure tests have easy // access to the required schema using the [Postgres.DB] method and the // [Postgres.Schema] method. If tests require using the default schema they can // disable unique schema creation using the [SkipSchemaIsolation] option, however // these tests should generally be considered disruptive. // The schema is automatically removed by the framework during the test teardown. // // Any non schema scoped resources, such as postgres roles, should use the // [f2.Context]'s RunID to ensure they will not cause conflicts with concurrent // tests, and authors should ensure all of these resources are cleaned up during // teardown. // // # Options // // [Option] that can be passed include: // 1. [ApplySeedModel]: Provides a method to migrate the database to the full edgesql schema. // 2. [SkipSchemaIsolation]: this provides a method to avoid tests generating their own pgsql schemas // // # Usage // // Examples can be found under `/test/f2/examples/pgtest` and can be run with: // // rosa //test/f2/examples/pgtest/... package postgres