Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
- Loading branch information
Pierre Tardy
committed
Nov 21, 2013
1 parent
fa362cf
commit 9ef7a38
Showing
5 changed files
with
220 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
# This file is part of Buildbot. Buildbot is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Buildbot Team Members | ||
|
||
from buildbot.data import forceschedulers | ||
from buildbot.schedulers.forcesched import ForceScheduler | ||
from buildbot.test.util import endpoint | ||
from twisted.internet import defer | ||
from twisted.trial import unittest | ||
|
||
|
||
expected_default = { | ||
'all_fields': [{'columns': 1, | ||
'default': '', | ||
'fields': [{'default': '', | ||
'fullName': 'username', | ||
'hide': False, | ||
'label': 'Your name:', | ||
'multiple': False, | ||
'name': 'username', | ||
'need_email': True, | ||
'regex': None, | ||
'required': False, | ||
'size': 30, | ||
'tablabel': 'Your name:', | ||
'type': 'text'}, | ||
{'default': 'force build', | ||
'fullName': 'reason', | ||
'hide': False, | ||
'label': 'reason', | ||
'multiple': False, | ||
'name': 'reason', | ||
'regex': None, | ||
'required': False, | ||
'size': 20, | ||
'tablabel': 'reason', | ||
'type': 'text'}], | ||
'fullName': None, | ||
'hide': False, | ||
'label': '', | ||
'layout': 'vertical', | ||
'multiple': False, | ||
'name': '', | ||
'regex': None, | ||
'required': False, | ||
'tablabel': '', | ||
'type': 'nested'}, | ||
{'columns': 2, | ||
'default': '', | ||
'fields': [{'default': '', | ||
'fullName': 'project', | ||
'hide': False, | ||
'label': 'Project:', | ||
'multiple': False, | ||
'name': 'project', | ||
'regex': None, | ||
'required': False, | ||
'size': 10, | ||
'tablabel': 'Project:', | ||
'type': 'text'}, | ||
{'default': '', | ||
'fullName': 'repository', | ||
'hide': False, | ||
'label': 'Repository:', | ||
'multiple': False, | ||
'name': 'repository', | ||
'regex': None, | ||
'required': False, | ||
'size': 10, | ||
'tablabel': 'Repository:', | ||
'type': 'text'}, | ||
{'default': '', | ||
'fullName': 'branch', | ||
'hide': False, | ||
'label': 'Branch:', | ||
'multiple': False, | ||
'name': 'branch', | ||
'regex': None, | ||
'required': False, | ||
'size': 10, | ||
'tablabel': 'Branch:', | ||
'type': 'text'}, | ||
{'default': '', | ||
'fullName': 'revision', | ||
'hide': False, | ||
'label': 'Revision:', | ||
'multiple': False, | ||
'name': 'revision', | ||
'regex': None, | ||
'required': False, | ||
'size': 10, | ||
'tablabel': 'Revision:', | ||
'type': 'text'}], | ||
'fullName': None, | ||
'hide': False, | ||
'label': '', | ||
'layout': 'vertical', | ||
'multiple': False, | ||
'name': '', | ||
'regex': None, | ||
'required': False, | ||
'tablabel': '', | ||
'type': 'nested'}], | ||
'builder_names': [u'builder'], | ||
'label': u'defaultforce', | ||
'name': u'defaultforce'} | ||
|
||
|
||
class ForceschedulerEndpoint(endpoint.EndpointMixin, unittest.TestCase): | ||
|
||
endpointClass = forceschedulers.ForceSchedulerEndpoint | ||
resourceTypeClass = forceschedulers.ForceScheduler | ||
|
||
def setUp(self): | ||
self.setUpEndpoint() | ||
scheds = [ForceScheduler( | ||
name="defaultforce", | ||
builderNames=["builder"])] | ||
self.master.allSchedulers = lambda: scheds | ||
|
||
def tearDown(self): | ||
self.tearDownEndpoint() | ||
|
||
@defer.inlineCallbacks | ||
def test_get_existing(self): | ||
res = yield self.callGet(('forceschedulers', "defaultforce")) | ||
self.validateData(res) | ||
self.assertEquals(res, expected_default) | ||
|
||
@defer.inlineCallbacks | ||
def test_get_missing(self): | ||
res = yield self.callGet(('forceschedulers', 'foo')) | ||
self.assertEquals(res, None) | ||
|
||
|
||
class ForceSchedulersEndpoint(endpoint.EndpointMixin, unittest.TestCase): | ||
|
||
endpointClass = forceschedulers.ForceSchedulersEndpoint | ||
resourceTypeClass = forceschedulers.ForceScheduler | ||
|
||
def setUp(self): | ||
self.setUpEndpoint() | ||
scheds = [ForceScheduler( | ||
name="defaultforce", | ||
builderNames=["builder"])] | ||
self.master.allSchedulers = lambda: scheds | ||
|
||
def tearDown(self): | ||
self.tearDownEndpoint() | ||
|
||
@defer.inlineCallbacks | ||
def test_get_existing(self): | ||
res = yield self.callGet(('forceschedulers', )) | ||
self.assertEquals(res, [expected_default]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ForceScheduler | ||
============== | ||
|
||
.. bb:rtype:: forcescheduler | ||
:attr string name: name of this scheduler | ||
:attr string name: label of this scheduler to be displayed in the ui | ||
:attr list if string buildername: names of the builders that this scheduler can trig | ||
:attr jsonObject all_fields: description of the fields that will be displayed in the UI | ||
|
||
A forcescheduler initiates builds, via a formular in the web UI. | ||
At the moment, forceschedulers must be defined on all the masters where a web ui is configured. A particular forcescheduler runs on the master where the web request was sent. | ||
|
||
.. bb:rpath:: /forceschedulers | ||
This path selects all forceschedulers. | ||
|
||
This endpoint has a control method with the following action: | ||
|
||
* force: | ||
|
||
create a buildrequest with this forcescheduler. It takes as parameters: | ||
|
||
- owner: the username that requested this build. | ||
- builderid: the builderid of the builder to force if builderNames is not specified | ||
- builderNames: the buildername of the builder to force | ||
- other params: other named params are the configured parameters of the forcescheduler | ||
|
||
.. bb:rpath:: /forceschedulers/:schedulername | ||
:pathkey string schedulername: the name of the scheduler | ||
|
||
This path selects a specific scheduler, identified by name. | ||
|