Skip to content

Guide efficient metadata#1

Closed
mcasquer wants to merge 3 commits intomainfrom
guide-efficient-metadata
Closed

Guide efficient metadata#1
mcasquer wants to merge 3 commits intomainfrom
guide-efficient-metadata

Conversation

@mcasquer
Copy link
Owner

@mcasquer mcasquer commented Jun 2, 2025

This is a Jules test

google-labs-jules bot and others added 3 commits June 2, 2025 12:10
This new chapter summarizes features for efficient metadata handling,
covering:
- fmf inheritance
- adjust based on context
- YAML referencing features (anchors and aliases)
- sharing tests across repositories

The chapter is added in `docs/guide/efficient-metadata.inc.rst`
and included in `docs/guide.rst`.
This new section in `docs/guide.rst` summarizes features for
efficient metadata handling, covering:
- fmf inheritance
- adjust based on context
- YAML referencing features (anchors and aliases)
- sharing tests across repositories

This addresses your feedback to add the content directly into the main
guide file instead of a separate .inc.rst file.
@mcasquer mcasquer closed this Jun 2, 2025
@mcasquer mcasquer deleted the guide-efficient-metadata branch June 2, 2025 13:36
mcasquer pushed a commit that referenced this pull request Aug 19, 2025
In verbose mode `-v` print the duration limit for each test during the
execute step.

Add tests to verify the correct value is printed.

For reference, how the log output looks on a failing test due to timeout
(updated after shift commit):
`-v`
```
    execute
        queued execute task #1: default-0 on default-0
        
        execute task #1: default-0 on default-0
        how: tmt
            duration limit: 2 seconds
            00:00:02 errr /test/duration-modified (on default-0) [1/1]
                00:00:00 fail internal/timeout (after-test check)
                    Note: Test exceeded maximum duration of 2s

    
        summary: 1 test executed
```

`-vv`
```
    execute
        queued execute task #1: default-0 on default-0
        
        execute task #1: default-0 on default-0
        how: tmt
        ignore-duration: false
        exit-first: false
            test: Adjust the duration in test metadata
                duration limit: 2 seconds
                cmd: sleep 3s
                00:00:02 errr /test/duration-modified (on default-0) [1/1]
                    00:00:00 fail internal/timeout (after-test check)
                        Note: Test exceeded maximum duration of 2s

    
        summary: 1 test executed
```

TF runs tmt with `-v` 

Fixes [teemtee#3856](teemtee#3856).
mcasquer pushed a commit that referenced this pull request Jan 19, 2026
Previously, SUPPORTED_DISTRO_PATTERNS was a
(shared) generator. That breaks use of fips prepare feature in multiple
plans within the same tmt run. Now SUPPORTED_DISTRO_PATTERS is just a
tuple and sharing has no negative effects.

Consider the following plan:

```
# reproducer.fmf
summary: Test plan

prepare:
  - name: Enable FIPS mode
    how: feature
    fips: enabled

execute:
  how: tmt

discover:
  - how: shell
    tests:
      - name: sample-test
        test: echo 'hello!'

/first:

/second:
```

Previously:

```
❯ tmt run plan --name /plans/reproducer discover provision --how minute --image rhel-10.1 prepare
/var/tmp/tmt/run-001

/plans/reproducer/first
    discover
        ...
    provision
        ....
        summary: 1 guest provisioned
    prepare
        queued push task #1: push to default-0

        push task #1: push to default-0

        queued prepare task #1: essential-requires on default-0
        queued prepare task #2: Enable FIPS mode on default-0

        prepare task #1: essential-requires on default-0
        how: install
        summary: Install essential required packages
        name: essential-requires
        where: default-0
        package: /usr/bin/python3 and /usr/bin/flock

        prepare task #2: Enable FIPS mode on default-0
        how: feature
        name: Enable FIPS mode
        Enable FIPS

        queued pull task #1: pull from default-0

        pull task #1: pull from default-0

        summary: 2 preparations applied

/plans/reproducer/second
    discover
        ...
    provision
        ...
        summary: 1 guest provisioned
    prepare
        queued push task #1: push to default-0

        push task #1: push to default-0

        queued prepare task #1: essential-requires on default-0
        queued prepare task #2: Enable FIPS mode on default-0

        prepare task #1: essential-requires on default-0
        how: install
        summary: Install essential required packages
        name: essential-requires
        where: default-0
        package: /usr/bin/python3 and /usr/bin/flock

        prepare task #2: Enable FIPS mode on default-0
        how: feature
        name: Enable FIPS mode
        fail: FIPS prepare feature is supported on RHEL/CentOS-Stream 8, 9 or 10.

plan failed

The exception was caused by 1 earlier exceptions

Cause number 1:

    prepare step failed

    The exception was caused by 1 earlier exceptions

    Cause number 1:

        FIPS prepare feature is supported on RHEL/CentOS-Stream 8, 9 or 10.
```

This is because now `SUPPORTED_DISTRO_PATTERNS` is a generator now.

```
SUPPORTED_DISTRO_PATTERNS = (
    re.compile(pattern)
    for pattern in (r'Red Hat Enterprise Linux (8|9|10)', r'CentOS Stream (8|9|10)')
)

```

And the prepare phase of the first plan already takes the first pattern
and hence there is nothing useful left for the prepare phase of the
second plan.

Signed-off-by: Ondrej Moris <ondrej.moris@gmail.com>
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.

1 participant