Skip to content

Test improvments#276

Merged
yairpod merged 2 commits into
trusted-execution-clusters:mainfrom
yairpod:test_improvments
Jun 16, 2026
Merged

Test improvments#276
yairpod merged 2 commits into
trusted-execution-clusters:mainfrom
yairpod:test_improvments

Conversation

@yairpod

@yairpod yairpod commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

For easier testing I am adding make targets to run the attestation and trusted_execution_cluster seperatly, and an env variable TEST_TIMEOUT_MULTIPLIER that will increase the timeouts of all tests for slower systems.

Summary by Sourcery

Add configurable test timeout scaling and new make targets for running specific integration test suites.

New Features:

  • Introduce TEST_TIMEOUT_MULTIPLIER environment variable to scale timeouts and durations across integration tests.
  • Add dedicated make targets for running only attestation or trusted_execution_cluster tests.

Enhancements:

  • Refactor existing test timeouts to use shared scaling helpers for durations.
  • Document the new timeout multiplier and targeted test make targets in the tests README.

@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an environment-driven test timeout scaling utility and wires it through long-running integration tests, plus introduces dedicated Make targets to run attestation and trusted_execution_cluster tests separately and documents their usage.

Flow diagram for new test Make targets and timeout multiplier

flowchart LR
    dev[Developer] --> attestation_tests[make attestation-tests]
    dev[Developer] --> trusted_cluster_tests[make trusted_execution_cluster-tests]

    attestation_tests --> cargo_attestation[cargo test --test attestation --features virtualization]
    trusted_cluster_tests --> cargo_trusted[cargo test --test trusted_execution_cluster --features virtualization]

    env_timeout[TEST_TIMEOUT_MULTIPLIER env var] --> timeout_util[Test timeout scaling utility]

    cargo_attestation --> timeout_util
    cargo_trusted --> timeout_util
Loading

File-Level Changes

Change Details Files
Introduce environment-based timeout scaling helpers and use them across long-running tests.
  • Add TEST_TIMEOUT_MULTIPLIER_ENV constant and timeout_multiplier() helper to read and parse the TEST_TIMEOUT_MULTIPLIER env var as f64 with default 1.0.
  • Add scaled_timeout(u64) and scaled_duration(u64) helpers to compute adjusted timeouts and Durations.
  • Replace hard-coded second-based timeout literals with scaled_timeout or scaled_duration in TestContext helpers and Kubernetes resource wait functions.
  • Update trusted_execution_cluster tests to use scaled_timeout and scaled_duration for resource creation, deletion, deployment readiness, and polling logic.
  • Update attestation tests to use scaled_timeout for VM lifecycle waits (running state, SSH readiness/unavailability) and resource deletion waits.
test_utils/src/lib.rs
tests/trusted_execution_cluster.rs
tests/attestation.rs
Add dedicated Make targets and documentation for running specific integration test suites with optional timeout scaling.
  • Add attestation-tests and trusted_execution_cluster-tests Make targets to run the corresponding integration test binaries with required environment variables and features.
  • Document TEST_TIMEOUT_MULTIPLIER usage for slow systems in tests/README.md.
  • Document how to run only the attestation or trusted_execution_cluster test sets via the new Make targets in tests/README.md.
Makefile
tests/README.md

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 timeout_multiplier() helper currently allows TEST_TIMEOUT_MULTIPLIER values of 0 or negative (which can lead to zero or effectively unbounded timeouts via float→u64 casting); consider clamping to a sane positive range (e.g. >= 1.0 and some upper bound) before applying it.
  • The new attestation-tests and trusted_execution_cluster-tests Makefile targets duplicate most of the integration-tests command; consider factoring out the common RUST_LOG/image/env setup into a single variable or pattern rule to reduce repetition and keep them in sync.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `timeout_multiplier()` helper currently allows `TEST_TIMEOUT_MULTIPLIER` values of 0 or negative (which can lead to zero or effectively unbounded timeouts via float→u64 casting); consider clamping to a sane positive range (e.g. `>= 1.0` and some upper bound) before applying it.
- The new `attestation-tests` and `trusted_execution_cluster-tests` Makefile targets duplicate most of the `integration-tests` command; consider factoring out the common `RUST_LOG`/image/env setup into a single variable or pattern rule to reduce repetition and keep them in sync.

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.

@yairpod yairpod force-pushed the test_improvments branch from 504c2c9 to 7782c98 Compare June 10, 2026 12:49

@Jakob-Naucke Jakob-Naucke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

commit message nit: separately, wrap lines

Comment thread Makefile Outdated
Comment thread Makefile Outdated
@yairpod yairpod force-pushed the test_improvments branch from 7782c98 to a21f7eb Compare June 15, 2026 14:40
@yairpod yairpod force-pushed the test_improvments branch 2 times, most recently from d08c496 to 7999ac3 Compare June 16, 2026 09:39
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Jakob-Naucke, yairpod

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@uril

uril commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Looks good to me, thanks

Yair Podemsky added 2 commits June 16, 2026 15:46
Add separate targets for attestation and trusted_execution_cluster tests so they can be run seperatly.

Signed-off-by: Yair Podemsky <ypodemsk@redhat.com>
Assisted-by: Opus:4.6
Add $TEST_TIMEOUT_MULTIPLIER env variable to scale all test timeouts
(e.g. 2, 1.5) for systems where VM and resource operations run slower.

Signed-off-by: Yair Podemsky <ypodemsk@redhat.com>
Assisted-by: Opus:4.6
@yairpod yairpod force-pushed the test_improvments branch from 7999ac3 to 12cdf53 Compare June 16, 2026 12:47
@openshift-ci openshift-ci Bot removed the lgtm label Jun 16, 2026
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@yairpod yairpod merged commit a3edb45 into trusted-execution-clusters:main Jun 16, 2026
10 checks passed
@yairpod yairpod deleted the test_improvments branch June 16, 2026 13:54
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