...

Source file src/edge-infra.dev/test/f2/x/postgres/doc.go

Documentation: edge-infra.dev/test/f2/x/postgres

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

View as plain text