Skip to content

Commit

Permalink
add unit sec to delay parameter (#33)
Browse files Browse the repository at this point in the history
The delay parameter requires a "sec" unit to function correctly.
  • Loading branch information
kkpattern authored Jun 24, 2023
1 parent d97c0cd commit 2b233e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aiojenkins/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def format_data(parameters: Optional[dict], kwargs: Any) -> Optional[dict]:
response = await self.jenkins._request(
'POST',
path,
params={'delay': delay},
params={'delay': '{0}sec'.format(delay)},
data=data,
)

Expand Down
12 changes: 12 additions & 0 deletions tests/test_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,15 @@ async def test_build_get_url_info(jenkins):

build_info = await jenkins.builds.get_url_info(build_url)
assert isinstance(build_info, dict) is True


@pytest.mark.asyncio
async def test_build_delay(jenkins):
async with CreateJob(jenkins) as job_name:
await jenkins.nodes.enable('master')
await jenkins.builds.start(job_name, delay=2)

await asyncio.sleep(1.5)
info = await jenkins.jobs.get_info(job_name)
builds = await jenkins.builds.get_all(job_name)
assert (info['inQueue'] is True and len(builds) == 0)

0 comments on commit 2b233e0

Please sign in to comment.