Tests: Add zuul trigger tests

Change-Id: Iefbcedeadc2dbe314555182abf96c087e9d7cbe8
This commit is contained in:
Vsevolod Fedorov 2023-01-16 12:43:09 +03:00
parent cd057a858a
commit f6d93251b9
7 changed files with 385 additions and 0 deletions

View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</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>

View File

@ -0,0 +1,10 @@
- job-template:
name: sample-job
triggers:
- zuul
- zuul-post
- project:
name: sample-project
jobs:
- sample-job

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</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>

View File

@ -0,0 +1,9 @@
- job-template:
name: sample-job
triggers:
- zuul-post
- project:
name: sample-project
jobs:
- sample-job

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</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>

View File

@ -0,0 +1,9 @@
- job-template:
name: sample-job
triggers:
- zuul
- project:
name: sample-project
jobs:
- sample-job

View 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()