Tests: Add zuul trigger tests
Change-Id: Iefbcedeadc2dbe314555182abf96c087e9d7cbe8
This commit is contained in:
parent
cd057a858a
commit
f6d93251b9
158
tests/triggers/job_fixtures/zuul-trigger-both.xml
Normal file
158
tests/triggers/job_fixtures/zuul-trigger-both.xml
Normal file
@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events (deprecated use ZUUL_UUID instead)</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PIPELINE</name>
|
||||
<description>Zuul pipeline triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_URL</name>
|
||||
<description>URL of Zuul's git repos accessible to workers</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PROJECT</name>
|
||||
<description>Branch name of triggering project</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_BRANCH</name>
|
||||
<description>Branch name of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGES</name>
|
||||
<description>List of dependent changes to merge</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REF</name>
|
||||
<description>Reference for the merged commit(s) to use</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_COMMIT</name>
|
||||
<description>The commit SHA1 at the head of ZUUL_REF</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGE_IDS</name>
|
||||
<description>List of included changes</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGE</name>
|
||||
<description>ID of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PATCHSET</name>
|
||||
<description>Patchset of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_VOTING</name>
|
||||
<description>Zuul considered this job voting or not</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events (deprecated use ZUUL_UUID instead)</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PIPELINE</name>
|
||||
<description>Zuul pipeline triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_URL</name>
|
||||
<description>URL of Zuul's git repos accessible to workers</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PROJECT</name>
|
||||
<description>Branch name of triggering project</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REF</name>
|
||||
<description>Name of updated reference triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REFNAME</name>
|
||||
<description>Name of updated reference triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_OLDREV</name>
|
||||
<description>Old SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_NEWREV</name>
|
||||
<description>New SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_SHORT_NEWREV</name>
|
||||
<description>Shortened new SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<builders/>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
10
tests/triggers/job_fixtures/zuul-trigger-both.yaml
Normal file
10
tests/triggers/job_fixtures/zuul-trigger-both.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- job-template:
|
||||
name: sample-job
|
||||
triggers:
|
||||
- zuul
|
||||
- zuul-post
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
jobs:
|
||||
- sample-job
|
80
tests/triggers/job_fixtures/zuul-trigger-post.xml
Normal file
80
tests/triggers/job_fixtures/zuul-trigger-post.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events (deprecated use ZUUL_UUID instead)</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PIPELINE</name>
|
||||
<description>Zuul pipeline triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_URL</name>
|
||||
<description>URL of Zuul's git repos accessible to workers</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PROJECT</name>
|
||||
<description>Branch name of triggering project</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REF</name>
|
||||
<description>Name of updated reference triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REFNAME</name>
|
||||
<description>Name of updated reference triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_OLDREV</name>
|
||||
<description>Old SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_NEWREV</name>
|
||||
<description>New SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_SHORT_NEWREV</name>
|
||||
<description>Shortened new SHA at this reference</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<builders/>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
9
tests/triggers/job_fixtures/zuul-trigger-post.yaml
Normal file
9
tests/triggers/job_fixtures/zuul-trigger-post.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- job-template:
|
||||
name: sample-job
|
||||
triggers:
|
||||
- zuul-post
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
jobs:
|
||||
- sample-job
|
98
tests/triggers/job_fixtures/zuul-trigger.xml
Normal file
98
tests/triggers/job_fixtures/zuul-trigger.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>UUID</name>
|
||||
<description>Zuul provided key to link builds with Gerrit events (deprecated use ZUUL_UUID instead)</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PIPELINE</name>
|
||||
<description>Zuul pipeline triggering this job</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_URL</name>
|
||||
<description>URL of Zuul's git repos accessible to workers</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PROJECT</name>
|
||||
<description>Branch name of triggering project</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_BRANCH</name>
|
||||
<description>Branch name of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGES</name>
|
||||
<description>List of dependent changes to merge</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_REF</name>
|
||||
<description>Reference for the merged commit(s) to use</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_COMMIT</name>
|
||||
<description>The commit SHA1 at the head of ZUUL_REF</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGE_IDS</name>
|
||||
<description>List of included changes</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_CHANGE</name>
|
||||
<description>ID of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_PATCHSET</name>
|
||||
<description>Patchset of triggering change</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition>
|
||||
<name>ZUUL_VOTING</name>
|
||||
<description>Zuul considered this job voting or not</description>
|
||||
<defaultValue/>
|
||||
<trim>false</trim>
|
||||
</hudson.model.StringParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<builders/>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
9
tests/triggers/job_fixtures/zuul-trigger.yaml
Normal file
9
tests/triggers/job_fixtures/zuul-trigger.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- job-template:
|
||||
name: sample-job
|
||||
triggers:
|
||||
- zuul
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
jobs:
|
||||
- sample-job
|
21
tests/triggers/test_job_triggers.py
Normal file
21
tests/triggers/test_job_triggers.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 / "job_fixtures"
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=scenario_list(fixtures_dir),
|
||||
ids=attrgetter("name"),
|
||||
)
|
||||
def scenario(request):
|
||||
return request.param
|
||||
|
||||
|
||||
def test_job(check_job):
|
||||
check_job()
|
Loading…
Reference in New Issue
Block a user