Skip to content

New test for postgresql pushmodel regression#1097

Open
4N0body5 wants to merge 2 commits into
rhel-10-mainfrom
nb-postgresql-pushmodel-regression
Open

New test for postgresql pushmodel regression#1097
4N0body5 wants to merge 2 commits into
rhel-10-mainfrom
nb-postgresql-pushmodel-regression

Conversation

@4N0body5

@4N0body5 4N0body5 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Add a regression test ensuring Keylime push-model attestation succeeds when using a PostgreSQL backend and does not trigger agent ID truncation issues.

Tests:

  • Add Beakerlib-based regression test that configures PostgreSQL and Keylime for push-model attestation and verifies successful agent attestation without StringDataRightTruncation errors.
  • Introduce associated fmf metadata and PostgreSQL setup script to provision verifier and registrar databases for the regression scenario.

@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new Beakerlib regression test that validates push-model attestation succeeds when Keylime is configured to use PostgreSQL, ensuring evidence_items.agent_id is a full UUID and that no string truncation occurs (RHEL-189524).

File-Level Changes

Change Details Files
Introduce a Beakerlib regression test that provisions PostgreSQL, configures Keylime for push-model attestation, and verifies attestation succeeds without agent_id truncation-related database errors.
  • Create a new test script that sets up PostgreSQL from a clean data directory, applies custom authentication and schema via a SQL setup script, and verifies required databases exist.
  • Configure Keylime verifier, registrar, and agent to use PostgreSQL, push-model mode, specific attestation intervals, and relaxed EK certificate requirements.
  • Start optional TPM and IMA emulators when needed, launch verifier, registrar, and push agent, enroll the agent, and wait for successful push-model attestation using keylime_tenant.
  • Assert that PostgreSQL logs do not contain StringDataRightTruncation errors and that the enrolled agent UUID appears in the CV list, then perform full cleanup of services, data, and configuration.
regression/push-model-attestation-fails-with-postgresql-db/test.sh
regression/push-model-attestation-fails-with-postgresql-db/main.fmf
regression/push-model-attestation-fails-with-postgresql-db/setup.psql

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The use of fixed sleep delays (e.g., sleep 3, sleep 5) after starting PostgreSQL and TPM-related services could be replaced with readiness checks to make the test more robust and less timing dependent.
  • The sed modification of pg_hba.conf assumes a specific existing line format; consider making this change more targeted or resilient (e.g., by matching exact fields or appending a dedicated entry) to avoid silent misconfiguration if the file changes.
  • Running rm -rf /var/lib/pgsql/data inside the test is quite destructive; if possible, constrain the test to a dedicated instance or path to avoid impacting any pre-existing PostgreSQL data on shared or reused environments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The use of fixed `sleep` delays (e.g., `sleep 3`, `sleep 5`) after starting PostgreSQL and TPM-related services could be replaced with readiness checks to make the test more robust and less timing dependent.
- The `sed` modification of `pg_hba.conf` assumes a specific existing line format; consider making this change more targeted or resilient (e.g., by matching exact fields or appending a dedicated entry) to avoid silent misconfiguration if the file changes.
- Running `rm -rf /var/lib/pgsql/data` inside the test is quite destructive; if possible, constrain the test to a dedicated instance or path to avoid impacting any pre-existing PostgreSQL data on shared or reused environments.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Fixed
Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Fixed
Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Fixed
Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Fixed
Comment thread regression/push-model-attestation-fails-with-postgresql-db/main.fmf Outdated
Comment thread regression/push-model-attestation-fails-with-postgresql-db/main.fmf Outdated
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Include Beakerlib environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Dismissed
Comment thread functional/push-model-attestation-with-postgresql-db/test.sh Dismissed

rlRun -s "sudo -u postgres psql -c 'SELECT datname FROM pg_database;'"
rlAssertGrep "verifierdb" $rlRun_LOG
rlAssertGrep "registrardb" $rlRun_LOG
@4N0body5 4N0body5 changed the title A new regression test for RHEL-189524 New test for postgresql pushmodel regression Jul 21, 2026
@4N0body5
4N0body5 force-pushed the nb-postgresql-pushmodel-regression branch from bc91ee5 to 681d289 Compare July 21, 2026 15:05
@4N0body5
4N0body5 force-pushed the nb-postgresql-pushmodel-regression branch from 681d289 to a9e20c7 Compare July 21, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants