Yaml parser tests: Add tests for views expansion
Currently, views handling part in YamlParser class is not covered at all. Change-Id: Ifaac0c44b0a0487e5673060d7b1f25393161f750
This commit is contained in:
parent
28d00a0e28
commit
60b9c23d33
@ -16,7 +16,7 @@ from jenkins_jobs.modules import project_multibranch
|
||||
from jenkins_jobs.modules import project_multijob
|
||||
from jenkins_jobs.parser import YamlParser
|
||||
from jenkins_jobs.registry import ModuleRegistry
|
||||
from jenkins_jobs.xml_config import XmlJob, XmlJobGenerator
|
||||
from jenkins_jobs.xml_config import XmlJob, XmlJobGenerator, XmlViewGenerator
|
||||
import jenkins_jobs.local_yaml as yaml
|
||||
|
||||
|
||||
@ -167,3 +167,28 @@ def check_job(scenario, expected_output, jjb_config, registry):
|
||||
assert stripped_expected_output == pretty_xml
|
||||
|
||||
return check
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_view(scenario, expected_output, jjb_config, registry):
|
||||
parser = YamlParser(jjb_config)
|
||||
|
||||
def check():
|
||||
parser.parse(str(scenario.in_path))
|
||||
registry.set_parser_data(parser.data)
|
||||
job_data_list, view_data_list = parser.expandYaml(registry)
|
||||
generator = XmlViewGenerator(registry)
|
||||
view_xml_list = generator.generateXML(view_data_list)
|
||||
view_xml_list.sort(key=AlphanumSort)
|
||||
|
||||
pretty_xml = (
|
||||
"\n".join(view.output().decode() for view in view_xml_list)
|
||||
.strip()
|
||||
.replace("\n\n", "\n")
|
||||
)
|
||||
stripped_expected_output = (
|
||||
expected_output.strip().replace("<BLANKLINE>", "").replace("\n\n", "\n")
|
||||
)
|
||||
assert stripped_expected_output == pretty_xml
|
||||
|
||||
return check
|
||||
|
21
tests/yamlparser/test_views.py
Normal file
21
tests/yamlparser/test_views.py
Normal file
@ -0,0 +1,21 @@
|
||||
from operator import attrgetter
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.enum_scenarios import scenario_list
|
||||
|
||||
|
||||
fixtures_dir = Path(__file__).parent / "view_fixtures"
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=scenario_list(fixtures_dir),
|
||||
ids=attrgetter("name"),
|
||||
)
|
||||
def scenario(request):
|
||||
return request.param
|
||||
|
||||
|
||||
def test_yaml_snippet(check_view):
|
||||
check_view()
|
8
tests/yamlparser/view_fixtures/add_managed_to_desc.xml
Normal file
8
tests/yamlparser/view_fixtures/add_managed_to_desc.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.AllView>
|
||||
<name>add_managed_to_desc</name>
|
||||
<description>My nice description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
9
tests/yamlparser/view_fixtures/add_managed_to_desc.yaml
Normal file
9
tests/yamlparser/view_fixtures/add_managed_to_desc.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- project:
|
||||
name: add_managed_to_desc
|
||||
views:
|
||||
- 'add_managed_to_desc'
|
||||
|
||||
- view-template:
|
||||
name: add_managed_to_desc
|
||||
description: 'My nice description'
|
||||
view-type: all
|
2
tests/yamlparser/view_fixtures/dont_overwrite_desc.conf
Normal file
2
tests/yamlparser/view_fixtures/dont_overwrite_desc.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[job_builder]
|
||||
keep_descriptions = True
|
8
tests/yamlparser/view_fixtures/dont_overwrite_desc.xml
Normal file
8
tests/yamlparser/view_fixtures/dont_overwrite_desc.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.AllView>
|
||||
<name>dont_overwrite_desc</name>
|
||||
<description/>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
8
tests/yamlparser/view_fixtures/dont_overwrite_desc.yaml
Normal file
8
tests/yamlparser/view_fixtures/dont_overwrite_desc.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
- project:
|
||||
name: dont_overwrite_desc
|
||||
views:
|
||||
- dont_overwrite_desc
|
||||
|
||||
- view-template:
|
||||
name: dont_overwrite_desc
|
||||
view-type: all
|
8
tests/yamlparser/view_fixtures/view-all-minimal.xml
Normal file
8
tests/yamlparser/view_fixtures/view-all-minimal.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.AllView>
|
||||
<name>All</name>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
3
tests/yamlparser/view_fixtures/view-all-minimal.yaml
Normal file
3
tests/yamlparser/view_fixtures/view-all-minimal.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- view:
|
||||
name: All
|
||||
view-type: all
|
22
tests/yamlparser/view_fixtures/view-custom-defaults.xml
Normal file
22
tests/yamlparser/view_fixtures/view-custom-defaults.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-minimal</name>
|
||||
<description>description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
20
tests/yamlparser/view_fixtures/view-custom-defaults.yaml
Normal file
20
tests/yamlparser/view_fixtures/view-custom-defaults.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
- defaults:
|
||||
name: my-defaults
|
||||
view_regex: (?!test.*).*
|
||||
my_columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
|
||||
- view-template:
|
||||
name: list-minimal
|
||||
defaults: my-defaults
|
||||
view-type: list
|
||||
description: 'description'
|
||||
columns: '{my_columns}'
|
||||
regex: '{view_regex}'
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
views:
|
||||
- list-minimal
|
54
tests/yamlparser/view_fixtures/view-dimentions-excludes.xml
Normal file
54
tests/yamlparser/view_fixtures/view-dimentions-excludes.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-1-11</name>
|
||||
<description>View N 1.11<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>1.11</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2-11</name>
|
||||
<description>View N 2.11<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>2.11</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2-22</name>
|
||||
<description>View N 2.22<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>2.22</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
19
tests/yamlparser/view_fixtures/view-dimentions-excludes.yaml
Normal file
19
tests/yamlparser/view_fixtures/view-dimentions-excludes.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
- view-template:
|
||||
name: my-view-{major}-{minor}
|
||||
view-type: list
|
||||
description: 'View N {major}.{minor}'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
regex: '{major}.{minor}'
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
major: [1, 2, 3]
|
||||
minor: [11, 22]
|
||||
exclude:
|
||||
- major: 1
|
||||
minor: 22
|
||||
- major: 3
|
||||
views:
|
||||
- my-view-{major}-{minor}
|
54
tests/yamlparser/view_fixtures/view-dimentions.xml
Normal file
54
tests/yamlparser/view_fixtures/view-dimentions.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-1</name>
|
||||
<description>View N1<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2</name>
|
||||
<description>View N2<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-3</name>
|
||||
<description>View N3<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>regex-for-view-3</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
19
tests/yamlparser/view_fixtures/view-dimentions.yaml
Normal file
19
tests/yamlparser/view_fixtures/view-dimentions.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
- view-template:
|
||||
name: my-view-{num}
|
||||
view-type: list
|
||||
description: 'View N{num}'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
regex: '{my_regex}'
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
my_regex: '(?!test.*).*'
|
||||
num:
|
||||
- 1
|
||||
- 2
|
||||
- 3:
|
||||
my_regex: regex-for-view-3
|
||||
views:
|
||||
- my-view-{num}
|
22
tests/yamlparser/view_fixtures/view-global-defaults.xml
Normal file
22
tests/yamlparser/view_fixtures/view-global-defaults.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-minimal</name>
|
||||
<description>description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
19
tests/yamlparser/view_fixtures/view-global-defaults.yaml
Normal file
19
tests/yamlparser/view_fixtures/view-global-defaults.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
- defaults:
|
||||
name: global
|
||||
view_regex: (?!test.*).*
|
||||
my_columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
|
||||
- view-template:
|
||||
name: list-minimal
|
||||
view-type: list
|
||||
description: 'description'
|
||||
columns: '{my_columns}'
|
||||
regex: '{view_regex}'
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
views:
|
||||
- list-minimal
|
66
tests/yamlparser/view_fixtures/view-group.xml
Normal file
66
tests/yamlparser/view_fixtures/view-group.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-1</name>
|
||||
<description>View N1<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2</name>
|
||||
<description>View N2<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-3</name>
|
||||
<description>View N3<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
24
tests/yamlparser/view_fixtures/view-group.yaml
Normal file
24
tests/yamlparser/view_fixtures/view-group.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
- view-template:
|
||||
name: my-view-{num}
|
||||
view-type: list
|
||||
description: 'View N{num}'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
regex: (?!test.*).*
|
||||
|
||||
- view-group:
|
||||
name: my-view-group
|
||||
views:
|
||||
- my-view-{num}
|
||||
- my-view-{num}:
|
||||
num: 3
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
views:
|
||||
- my-view-{num}:
|
||||
num: 1
|
||||
- my-view-group:
|
||||
num: 2
|
22
tests/yamlparser/view_fixtures/view-list-minimal.xml
Normal file
22
tests/yamlparser/view_fixtures/view-list-minimal.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-minimal</name>
|
||||
<description>description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
14
tests/yamlparser/view_fixtures/view-list-minimal.yaml
Normal file
14
tests/yamlparser/view_fixtures/view-list-minimal.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
- view:
|
||||
name: list-minimal
|
||||
view-type: list
|
||||
description: 'description'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
regex: (?!test.*).*
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
views:
|
||||
- list-minimal
|
66
tests/yamlparser/view_fixtures/view-none-params.xml
Normal file
66
tests/yamlparser/view_fixtures/view-none-params.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-1</name>
|
||||
<description>View N1<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2</name>
|
||||
<description>View N2<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-3</name>
|
||||
<description>View N3<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
25
tests/yamlparser/view_fixtures/view-none-params.yaml
Normal file
25
tests/yamlparser/view_fixtures/view-none-params.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
# Check with None as parameters value instead of dict.
|
||||
- view-template:
|
||||
name: my-view-{num}
|
||||
view-type: list
|
||||
description: 'View N{num}'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
regex: (?!test.*).*
|
||||
|
||||
- view-group:
|
||||
name: my-view-group
|
||||
views:
|
||||
- my-view-{num}:
|
||||
- my-view-{num}:
|
||||
num: 3
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
num: 1
|
||||
views:
|
||||
- my-view-{num}:
|
||||
- my-view-group:
|
||||
num: 2
|
54
tests/yamlparser/view_fixtures/view-parameter-precedence.xml
Normal file
54
tests/yamlparser/view_fixtures/view-parameter-precedence.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-1</name>
|
||||
<description>View N1<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>1-project 2-view-param 3-project 4-template 5-defaults</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-2</name>
|
||||
<description>View N2<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>1-project 2-group-param 3-group-param 4-template 5-defaults</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>my-view-3</name>
|
||||
<description>View N3<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
</columns>
|
||||
<includeRegex>1-project 2-group-param 3-group 4-template 5-defaults</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
@ -0,0 +1,42 @@
|
||||
- defaults:
|
||||
name: global
|
||||
param_1: '1-defaults'
|
||||
param_2: '2-defaults'
|
||||
param_3: '3-defaults'
|
||||
param_4: '4-defaults'
|
||||
param_5: '5-defaults' # Should be used.
|
||||
|
||||
- view-template:
|
||||
name: my-view-{num}
|
||||
view-type: list
|
||||
param_1: '1-template'
|
||||
param_2: '2-template'
|
||||
param_3: '3-template'
|
||||
param_4: '4-template' # Should be used.
|
||||
description: 'View N{num}'
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
regex: '{param_1} {param_2} {param_3} {param_4} {param_5}'
|
||||
|
||||
- view-group:
|
||||
name: my-view-group
|
||||
views:
|
||||
- my-view-{num}:
|
||||
num: 2
|
||||
- my-view-{num}:
|
||||
num: 3
|
||||
param_3: '3-group' # Should be used.
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
param_1: '1-project' # Should be used.
|
||||
param_2: '2-project'
|
||||
param_3: '3-project'
|
||||
views:
|
||||
- my-view-{num}:
|
||||
num: 1
|
||||
param_2: '2-view-param' # Should be used.
|
||||
- my-view-group:
|
||||
param_2: '2-group-param' # Should be used.
|
||||
param_3: '3-group-param'
|
44
tests/yamlparser/view_fixtures/view-template-id.xml
Normal file
44
tests/yamlparser/view_fixtures/view-template-id.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>not-as-simple-template-test-ids-2-canary</name>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>not-as-simple-template-test-ids-{num}-{type} Goodbye World 2 canary</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>simple-template-test-ids-1-periodic</name>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>simple-template-test-ids-{num}-{type} Hello World 1 periodic</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
31
tests/yamlparser/view_fixtures/view-template-id.yaml
Normal file
31
tests/yamlparser/view_fixtures/view-template-id.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
- project:
|
||||
name: test_template_id
|
||||
views:
|
||||
- simple-template:
|
||||
test_var: Hello World
|
||||
type: periodic
|
||||
num: 1
|
||||
- not-as-simple-template:
|
||||
test_var: Goodbye World
|
||||
type: canary
|
||||
num: 2
|
||||
|
||||
- view-template:
|
||||
name: 'simple-template-test-ids-{num}-{type}'
|
||||
id: simple-template
|
||||
view-type: list
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
regex: '{template-name} {test_var} {num} {type}'
|
||||
|
||||
- view-template:
|
||||
name: 'not-as-simple-template-test-ids-{num}-{type}'
|
||||
id: not-as-simple-template
|
||||
view-type: list
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
regex: '{template-name} {test_var} {num} {type}'
|
22
tests/yamlparser/view_fixtures/view-template-with-params.xml
Normal file
22
tests/yamlparser/view_fixtures/view-template-with-params.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-minimal</name>
|
||||
<description>description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
@ -0,0 +1,16 @@
|
||||
- view-template:
|
||||
name: list-minimal
|
||||
view-type: list
|
||||
description: 'description'
|
||||
columns: '{columns}'
|
||||
regex: '{regex}'
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
views:
|
||||
- list-minimal:
|
||||
regex: (?!test.*).*
|
22
tests/yamlparser/view_fixtures/view-template.xml
Normal file
22
tests/yamlparser/view_fixtures/view-template.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-minimal</name>
|
||||
<description>description<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters/>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<jenkins.plugins.extracolumns.BuildParametersColumn plugin="extra-columns">
|
||||
<singlePara>true</singlePara>
|
||||
<parameterName>MY_PARAMETER</parameterName>
|
||||
</jenkins.plugins.extracolumns.BuildParametersColumn>
|
||||
</columns>
|
||||
<includeRegex>(?!test.*).*</includeRegex>
|
||||
<recurse>false</recurse>
|
||||
</hudson.model.ListView>
|
15
tests/yamlparser/view_fixtures/view-template.yaml
Normal file
15
tests/yamlparser/view_fixtures/view-template.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
- view-template:
|
||||
name: list-minimal
|
||||
view-type: list
|
||||
description: 'description'
|
||||
columns: '{columns}'
|
||||
regex: (?!test.*).*
|
||||
|
||||
- project:
|
||||
name: test-project
|
||||
columns:
|
||||
- status
|
||||
- weather
|
||||
- extra-build-parameter: MY_PARAMETER
|
||||
views:
|
||||
- list-minimal
|
Loading…
Reference in New Issue
Block a user