Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/6045~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/6045
Choose a head ref
  • 8 commits
  • 35 files changed
  • 3 contributors

Commits on Nov 27, 2025

  1. meson: Include TAP tests in the configuration summary

    ...to make it obvious when they've been enabled. prove is added to the
    executables list for good measure.
    
    TODO: does Autoconf need something similar?
    
    Per complaint by Peter Eisentraut.
    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    c919614 View commit details
    Browse the repository at this point in the history
  2. Add support for pytest test suites

    Specify --enable-pytest/-Dpytest=enabled at configure time. This
    contains no Postgres test logic -- it is just a "vanilla" pytest
    skeleton.
    
    I've written a custom pgtap output plugin, used by the Meson mtest
    runner, to fully control what we see during CI test failures. The
    pytest-tap plugin would have been preferable, but it's now in
    maintenance mode, and it has problems with accidentally suppressing
    important collection failures.
    
    test_something.py is intended to show a sample failure in the CI.
    
    TODOs:
    - OpenBSD has an ANSI-related terminal bug, but I'm not sure if the bug
      is in Cirrus, the image, pytest, Python, or readline. The TERM envvar
      is unset to work around it. If this workaround is removed, a bad ANSI
      escape is inserted into the pgtap output and mtest is unable to parse
      it.
    - The Chocolatey CI setup is subpar. Need to find a way to bless the
      dependencies in use rather than pulling from pip... or maybe that will
      be done by the image baker.
    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    370c5ba View commit details
    Browse the repository at this point in the history
  3. WIP: pytest: Add some SSL client tests

    This is a sample client-only test suite. It tests some handshake
    failures against a mock server, as well as a full SSL handshake + empty
    query + response.
    
    pyca/cryptography is added as a new package dependency. Certificates for
    testing are generated on the fly.
    
    The `pg` test package contains some helpers and fixtures (as well as
    some self-tests for more complicated behavior). Of note:
    
    - pg.require_test_extra() lets you mark a test/class/module as skippable
      if PG_TEST_EXTRA does not contain the necessary strings.
    
    - pg.remaining_timeout() is a function which can be repeatedly called to
      determine how much of the PG_TEST_TIMEOUT_DEFAULT remains for the
      current test item.
    
    - pg.libpq is a fixture that wraps libpq.so in a more friendly, but
      still low-level, ctypes FFI. Allocated resources are unwound and
      released during test teardown.
    
    The mock design is threaded: the server socket is listening on a
    background thread, and the test provides the server logic via a
    callback. There is some additional work still needed to make this
    production-ready; see the notes for _TCPServer.background(). (Currently,
    an exception in the wrong place could result in a hang-until-timeout
    rather than an immediate failure.)
    
    TODOs:
    - local_server and tcp_server_class are nearly identical and should
      share code.
    - fix exception-related timeouts for .background()
    - figure out the proper use of "session" vs "module" scope
    - ensure that pq.libpq unwinds (to close connections) before tcp_server;
      see comment in test_server_with_ssl_disabled()
    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    bb85720 View commit details
    Browse the repository at this point in the history
  4. WIP: pytest: Add some server-side SSL tests

    In the same vein as the previous commit, this is a server-only test
    suite operating against a mock client. The test itself is a heavily
    parameterized check for direct-SSL handshake behavior, using a
    combination of "standard" and "custom" certificates via the certs
    fixture.
    
    installcheck is currently unsupported, but the architecture has some
    extension points that should make it possible later. For now, a new
    server is always started for the test session.
    
    New session-level fixtures have been added which probably need to
    migrate to the `pg` package. Of note:
    
    - datadir points to the server's data directory
    - sockdir points to the server's UNIX socket/lock directory
    - server_instance actually inits and starts a server via the pg_ctl on
      PATH (and could eventually point at an installcheck target)
    
    Wrapping these session-level fixtures is pg_server[_session], which
    provides APIs for configuration changes that unwind themselves at the
    end of fixture scopes. There's also an example of nested scopes, via
    pg_server_session.subcontext(). Many TODOs remain before we're on par
    with Test::Cluster, but this should illustrate my desired architecture
    pretty well.
    
    Windows currently uses SCRAM-over-UNIX for the admin account rather than
    SSPI-over-TCP. There's some dead Win32 code in pg.current_windows_user,
    but I've kept it as an illustration of how a developer might write such
    code for SSPI. I'll probably remove it in a future patch version.
    
    TODOs:
    - port more server configuration behavior from PostgreSQL::Test::Cluster
    - decide again on "session" vs. "module" scope for server fixtures
    - improve remaining_timeout() integration with socket operations; at the
      moment, the timeout resets on every call rather than decrementing
    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    d1e4ca8 View commit details
    Browse the repository at this point in the history
  5. ci: Add MTEST_SUITES for optional test tailoring

    Should make it easier to control the test cycle time for Cirrus. Add the
    desired suites (remembering `--suite setup`!) to the top-level envvar.
    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    6bd160c View commit details
    Browse the repository at this point in the history
  6. XXX run pytest and ssl suite, all OSes

    jchampio authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    acb43cd View commit details
    Browse the repository at this point in the history
  7. Refactor and improve pytest infrastructure

    This change does a lot of refactoring and adding new features to the
    pytest based test infrastructure.
    
    The primary features it adds are:
    - A `sql` method on `PGconn`: It takes a query and returns the results
      as native python types.
    - A `conn` fixture: Which is a libpq based connection to the default
      Postgres server.
    - Use the `pg_config` binary to find the libdir and bindir (can be
      overridden by setting PG_CONFIG). Otherwise I had to use
      LD_LIBRARY_PATH when running pytest manually.
    
    The refactoring it does:
    - Rename `pg_server` fixture to `pg` since it'll likely be one of the
      most commonly used ones.
    - Rename `pg` module to `pypg` to avoid naming conflict/shadowing
      problems with the newly renamed `pg` fixture
    - Move class definitions outside of fixtures to separate modules (either
      in the `pypg` module or the new `libpq` module)
    - Move all "general" fixtures to the `pypg.fixtures` module, instead of
      having them be defined in the ssl module.
    JelteF authored and Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    853a446 View commit details
    Browse the repository at this point in the history
  8. [CF 6045] v3 - RFC: adding pytest as a supported test framework

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6045
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/DE5BODEZ607Y.3LNII22O5N27O@jeltef.nl
    Author(s): Jacob Champion, Jelte Fennema-Nio
    Commitfest Bot committed Nov 27, 2025
    Configuration menu
    Copy the full SHA
    8420971 View commit details
    Browse the repository at this point in the history
Loading