Add test for macros using defaults

Change-Id: I62ac7b8056b5e8151b68675551453c95c7822c6c
This commit is contained in:
Vsevolod Fedorov 2024-01-24 11:51:25 +03:00
parent 11280dcad1
commit 06366b02e7
6 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,18 @@
macro-uses-custom-defaults.yaml:34:3: In project 'sample-project'
- project:
^
macro-uses-custom-defaults.yaml:37:7: Defined here
- sample-job-template
^
macro-uses-custom-defaults.yaml:26:3: In job template 'sample-job-template'
- job-template:
^
macro-uses-custom-defaults.yaml:30:7: While expanding builder macro call 'builder-without-params'
- builder-without-params
^
macro-uses-custom-defaults.yaml:7:3: While expanding macro 'builder-without-params'
- builder:
^
macro-uses-custom-defaults.yaml:12:9: While formatting string 'echo "builder-without-params: Fails when trying to expand: {global_param}"\n...': Missing parameter: 'global_param'
echo "builder-without-params: Fails when tryi ...
^

View File

@ -0,0 +1,37 @@
# Macros do not use custom defaults.
- defaults:
name: custom
global_param: sample global param value
- builder:
name: builder-without-params
# defaults: custom
builders:
- shell: |
echo "builder-without-params: Fails when trying to expand: {global_param}"
# Also fails when trying to expand:
- shell: !include-raw-expand: macro-uses-custom-defaults.yaml.inc
- builder:
name: builder-with-params
# defaults: custom
builders:
- shell: |
echo "builder-with-params: Should be expanded: {param}"
- shell: |
echo "builder-with-params: Fails when trying to expand: {global_param}"
- shell: !include-raw-expand: macro-uses-custom-defaults.yaml.inc
- job-template:
name: sample-job-template
display-name: sample-job-template
builders:
- builder-without-params
- builder-with-params:
param: sample macro param value
- project:
name: sample-project
jobs:
- sample-job-template

View File

@ -0,0 +1 @@
echo "include-raw-expand: Fails when trying to expand: {global_param}"

View File

@ -0,0 +1,18 @@
macro-uses-global-defaults.yaml:32:3: In project 'sample-project'
- project:
^
macro-uses-global-defaults.yaml:35:7: Defined here
- sample-job-template
^
macro-uses-global-defaults.yaml:24:3: In job template 'sample-job-template'
- job-template:
^
macro-uses-global-defaults.yaml:28:7: While expanding builder macro call 'builder-without-params'
- builder-without-params
^
macro-uses-global-defaults.yaml:7:3: While expanding macro 'builder-without-params'
- builder:
^
macro-uses-global-defaults.yaml:11:9: While formatting string 'echo "builder-without-params: Fails when trying to expand: {global_param}"\n...': Missing parameter: 'global_param'
echo "builder-without-params: Fails when tryi ...
^

View File

@ -0,0 +1,35 @@
# Macros do not use global defaults.
- defaults:
name: global
global_param: sample global param value
- builder:
name: builder-without-params
builders:
- shell: |
echo "builder-without-params: Fails when trying to expand: {global_param}"
# Also fails when trying to expand:
- shell: !include-raw-expand: macro-uses-global-defaults.yaml.inc
- builder:
name: builder-with-params
builders:
- shell: |
echo "builder-with-params: Should be expanded: {param}"
- shell: |
echo "builder-with-params: Fails when trying to expand: {global_param}"
- shell: !include-raw-expand: macro-uses-global-defaults.yaml.inc
- job-template:
name: sample-job-template
display-name: sample-job-template
builders:
- builder-without-params
- builder-with-params:
param: sample macro param value
- project:
name: sample-project
jobs:
- sample-job-template

View File

@ -0,0 +1 @@
echo "include-raw-expand: Fails when trying to expand: {global_param}"