Update runscope plugin to use convert xml
- Add plugin="runscope" attribute for consistency - Add full test - Rename minimal test to be more descriptive Change-Id: I9d0e1fea404f16d2ff4f8bde1d00510128a43b93 Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
parent
80aa526616
commit
6f83f6e755
@ -3243,20 +3243,26 @@ def runscope(parser, xml_parent, data):
|
|||||||
:arg str access-token: OAuth Personal Access token. (required)
|
:arg str access-token: OAuth Personal Access token. (required)
|
||||||
:arg int timeout: Timeout for test duration in seconds. (default 60)
|
:arg int timeout: Timeout for test duration in seconds. (default 60)
|
||||||
|
|
||||||
Example:
|
Minimal Example:
|
||||||
|
|
||||||
.. literalinclude:: /../../tests/builders/fixtures/runscope.yaml
|
.. literalinclude:: /../../tests/builders/fixtures/runscope-minimal.yaml
|
||||||
|
:language: yaml
|
||||||
|
|
||||||
|
Full Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/builders/fixtures/runscope-full.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
runscope = XML.SubElement(xml_parent,
|
runscope = XML.SubElement(xml_parent,
|
||||||
'com.runscope.jenkins.Runscope.RunscopeBuilder')
|
'com.runscope.jenkins.Runscope.RunscopeBuilder')
|
||||||
try:
|
runscope.set('plugin', 'runscope')
|
||||||
XML.SubElement(runscope, 'triggerEndPoint').text = data[
|
|
||||||
"test-trigger-url"]
|
mapping = [
|
||||||
XML.SubElement(runscope, 'accessToken').text = data["access-token"]
|
('test-trigger-url', 'triggerEndPoint', None),
|
||||||
except KeyError as e:
|
('access-token', 'accessToken', None),
|
||||||
raise MissingAttributeError(e.args[0])
|
('timeout', 'timeout', 60),
|
||||||
XML.SubElement(runscope, 'timeout').text = str(data.get('timeout', '60'))
|
]
|
||||||
|
convert_mapping_to_xml(runscope, data, mapping, fail_required=True)
|
||||||
|
|
||||||
|
|
||||||
def description_setter(parser, xml_parent, data):
|
def description_setter(parser, xml_parent, data):
|
||||||
|
10
tests/builders/fixtures/runscope-full.xml
Normal file
10
tests/builders/fixtures/runscope-full.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<builders>
|
||||||
|
<com.runscope.jenkins.Runscope.RunscopeBuilder plugin="runscope">
|
||||||
|
<triggerEndPoint>https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger</triggerEndPoint>
|
||||||
|
<accessToken>123456</accessToken>
|
||||||
|
<timeout>123</timeout>
|
||||||
|
</com.runscope.jenkins.Runscope.RunscopeBuilder>
|
||||||
|
</builders>
|
||||||
|
</project>
|
5
tests/builders/fixtures/runscope-full.yaml
Normal file
5
tests/builders/fixtures/runscope-full.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
builders:
|
||||||
|
- runscope:
|
||||||
|
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
|
||||||
|
access-token: "123456"
|
||||||
|
timeout: 123
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<project>
|
<project>
|
||||||
<builders>
|
<builders>
|
||||||
<com.runscope.jenkins.Runscope.RunscopeBuilder>
|
<com.runscope.jenkins.Runscope.RunscopeBuilder plugin="runscope">
|
||||||
<triggerEndPoint>https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger</triggerEndPoint>
|
<triggerEndPoint>https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger</triggerEndPoint>
|
||||||
<accessToken>123456</accessToken>
|
<accessToken>123456</accessToken>
|
||||||
<timeout>60</timeout>
|
<timeout>60</timeout>
|
@ -2,4 +2,3 @@ builders:
|
|||||||
- runscope:
|
- runscope:
|
||||||
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
|
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
|
||||||
access-token: "123456"
|
access-token: "123456"
|
||||||
timeout: 60
|
|
Loading…
Reference in New Issue
Block a user