Project

General

Profile

Actions

action #66865

open

openQA Tests (public) - coordination #15132: [saga][epic] Better structure of test plans in main.pm

Support !inherit tag in YAML job templates

Added by livdywan over 4 years ago. Updated about 2 years ago.

Status:
Workable
Priority:
Low
Assignee:
-
Category:
Feature requests
Target version:
Start date:
2020-05-14
Due date:
% Done:

0%

Estimated time:

Description

Motivation

Our extensive use of YAML merge keys << is hitting limits. Only the top level is merged. In the context of scenarios it can be more desirable to include settings, which are at the second level.

Acceptance criteria

  • AC1: A "deep merge" of multi-level YAML sections are possible within one YAML document with a special tag

Suggestions

tinita wrote:

Just a note: YAML Merge Keys << are not performing a "deep merge". It only merges at the top level.
So in the following example the settings would only contain the ANOTHER_SETTING.

- .testsuite: &crypt_no_lvm
    description: |
      bla bla bla
    settings:
      YAML_SCHEDULE: schedule/yast/encryption/crypt_no_lvm.yaml
      YAML_TEST_DATA: test_data/yast/encryption/encrypt_no_lvm.yaml
- crypt_no_lvm:
    settings:
      ANOTHER_SETTING: foo
    <<: *crypt_no_lvm

Resulting data with resolved merge keys:

- .testsuite:
    description: |
      bla bla bla
    settings:
      YAML_SCHEDULE: schedule/yast/encryption/crypt_no_lvm.yaml
      YAML_TEST_DATA: test_data/yast/encryption/encrypt_no_lvm.yaml
- crypt_no_lvm:
    description: |
      bla bla bla
    settings:
      ANOTHER_SETTING: foo

A custom tag which I will call !inherit could fix that. And although I'm hesistant to diverge from standard YAML, I think we could try and keep it generic and straightforward to implement in e.g. YAML schedules or Python code.

Proposal in #66865#note-1

Actions

Also available in: Atom PDF