rundeck 0.0.3.pre → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +0 -10
- data/.travis.yml +1 -1
- data/lib/rundeck/client.rb +61 -3
- data/lib/rundeck/client/execution.rb +194 -0
- data/lib/rundeck/client/{jobs.rb → job.rb} +19 -36
- data/lib/rundeck/client/{keys.rb → key.rb} +42 -20
- data/lib/rundeck/configuration.rb +5 -1
- data/lib/rundeck/objectified_hash.rb +13 -3
- data/lib/rundeck/request.rb +7 -1
- data/lib/rundeck/version.rb +1 -1
- data/rundeck.gemspec +2 -1
- data/spec/cassettes/12/abort_execution_not_running.yml +41 -0
- data/spec/cassettes/12/abort_execution_valid.yml +41 -0
- data/spec/cassettes/12/abort_executions_invalid.yml +41 -0
- data/spec/cassettes/12/bulk_delete_executions_invalid.yml +46 -0
- data/spec/cassettes/12/bulk_delete_executions_valid.yml +41 -0
- data/spec/cassettes/12/create_private_key.yml +64 -0
- data/spec/cassettes/12/create_public_key.yml +38 -0
- data/spec/cassettes/12/delete_execution_invalid.yml +41 -0
- data/spec/cassettes/12/delete_execution_valid.yml +32 -0
- data/spec/cassettes/12/delete_job_executions.yml +41 -0
- data/spec/cassettes/12/delete_job_executions_invalid.yml +41 -0
- data/spec/cassettes/12/delete_job_invalid.yml +41 -0
- data/spec/cassettes/12/delete_job_valid.yml +32 -0
- data/spec/cassettes/12/delete_key_invalid.yml +41 -0
- data/spec/cassettes/12/delete_key_private.yml +32 -0
- data/spec/cassettes/12/delete_key_public.yml +32 -0
- data/spec/cassettes/12/execution_invalid.yml +41 -0
- data/spec/cassettes/12/execution_query_invalid.yml +39 -0
- data/spec/cassettes/12/execution_query_no_params_valid.yml +124 -0
- data/spec/cassettes/12/execution_state_invalid.yml +41 -0
- data/spec/cassettes/12/execution_state_valid.yml +39 -0
- data/spec/cassettes/12/execution_valid.yml +60 -0
- data/spec/cassettes/12/export_job_xml.yml +234 -0
- data/spec/cassettes/12/export_job_yaml.yml +228 -0
- data/spec/cassettes/12/import_job_xml.yml +69 -0
- data/spec/cassettes/12/import_job_yaml.yml +63 -0
- data/spec/cassettes/12/job.yml +84 -0
- data/spec/cassettes/12/job_executions.yml +96 -0
- data/spec/cassettes/12/jobs.yml +76 -0
- data/spec/cassettes/12/key_contents_direct.yml +67 -0
- data/spec/cassettes/12/key_contents_multiple.yml +38 -0
- data/spec/cassettes/12/key_contents_private.yml +35 -0
- data/spec/cassettes/12/key_metadata_direct.yml +35 -0
- data/spec/cassettes/12/key_metadata_multiple.yml +38 -0
- data/spec/cassettes/12/keys_direct.yml +35 -0
- data/spec/cassettes/12/keys_multiple.yml +38 -0
- data/spec/cassettes/12/keys_none.yml +34 -0
- data/spec/cassettes/12/run_job_invalid.yml +44 -0
- data/spec/cassettes/12/run_job_valid.yml +77 -0
- data/spec/cassettes/12/running_jobs_multiple.yml +70 -0
- data/spec/cassettes/12/running_jobs_none.yml +39 -0
- data/spec/cassettes/12/running_jobs_single.yml +55 -0
- data/spec/cassettes/12/update_private_key.yml +96 -0
- data/spec/cassettes/12/update_public_key.yml +70 -0
- data/spec/rundeck/client/execution_spec.rb +346 -0
- data/spec/rundeck/client/job_spec.rb +175 -0
- data/spec/rundeck/client/key_spec.rb +223 -0
- data/spec/spec_helper.rb +15 -60
- data/spec/support/helpers.rb +136 -0
- metadata +118 -35
- data/spec/fixtures/empty.xml +0 -0
- data/spec/fixtures/job.xml +0 -17
- data/spec/fixtures/job_executions.xml +0 -31
- data/spec/fixtures/job_run.xml +0 -16
- data/spec/fixtures/jobs_import.xml +0 -23
- data/spec/fixtures/jobs_my_project.xml +0 -14
- data/spec/fixtures/jobs_xml.xml +0 -32
- data/spec/fixtures/jobs_yaml.xml +0 -22
- data/spec/fixtures/key_contents_public.xml +0 -1
- data/spec/fixtures/key_private.xml +0 -8
- data/spec/fixtures/key_public.xml +0 -7
- data/spec/fixtures/keys.xml +0 -27
- data/spec/rundeck/client/jobs_spec.rb +0 -181
- data/spec/rundeck/client/keys_spec.rb +0 -216
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/executions/running?project=anvils
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=1odk7ci04f2gbx2e5qgv12d1s;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- text/xml;charset=UTF-8
|
25
|
+
X-Rundeck-Api-Version:
|
26
|
+
- '12'
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Server:
|
30
|
+
- Jetty(7.6.0.v20120127)
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
34
|
+
<result success='true' apiversion='12'>
|
35
|
+
<executions count='0' />
|
36
|
+
</result>
|
37
|
+
http_version:
|
38
|
+
recorded_at: Sat, 11 Oct 2014 20:42:29 GMT
|
39
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/executions/running?project=anvils
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=12hu1xlsf8g5vsh0efvulu4ms;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- text/xml;charset=UTF-8
|
25
|
+
X-Rundeck-Api-Version:
|
26
|
+
- '12'
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Server:
|
30
|
+
- Jetty(7.6.0.v20120127)
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
34
|
+
<result success='true' apiversion='12'>
|
35
|
+
<executions count='2'>
|
36
|
+
<execution id='15' href='http://192.168.50.2:4440/execution/follow/15' status='running' project='anvils'>
|
37
|
+
<user>admin</user>
|
38
|
+
<date-started unixtime='1413059515662'>2014-10-11T20:31:55Z</date-started>
|
39
|
+
<job id='2065685b-776a-4f1a-8fa8-7df90f9060aa' averageDuration='4884'>
|
40
|
+
<name>Status</name>
|
41
|
+
<group>anvils</group>
|
42
|
+
<project>anvils</project>
|
43
|
+
<description>Check the status of anvils</description>
|
44
|
+
<options>
|
45
|
+
<option name='dir' value='$HOME/anvils' />
|
46
|
+
</options>
|
47
|
+
</job>
|
48
|
+
<description>http://localhost/anvils/scripts/status.sh -- ${option.dir}</description>
|
49
|
+
<argstring>-dir $HOME/anvils</argstring>
|
50
|
+
</execution>
|
51
|
+
</executions>
|
52
|
+
</result>
|
53
|
+
http_version:
|
54
|
+
recorded_at: Sat, 11 Oct 2014 20:32:00 GMT
|
55
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/storage/keys/path/to/private_key2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=yyiy50vvu9u81htescsl8ry4;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/xml;charset=utf-8
|
25
|
+
Transfer-Encoding:
|
26
|
+
- chunked
|
27
|
+
Server:
|
28
|
+
- Jetty(7.6.0.v20120127)
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: <resource path='keys/path/to/private_key2' type='file' url='http://192.168.50.2:4440/api/12/storage/keys/path/to/private_key2'
|
32
|
+
name='private_key2'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>1679</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-key-type>private</Rundeck-key-type></resource-meta></resource>
|
33
|
+
http_version:
|
34
|
+
recorded_at: Sat, 11 Oct 2014 19:13:33 GMT
|
35
|
+
- request:
|
36
|
+
method: put
|
37
|
+
uri: http://192.168.50.2:4440/api/12/storage/keys/path/to/private_key2
|
38
|
+
body:
|
39
|
+
encoding: UTF-8
|
40
|
+
string: |
|
41
|
+
-----BEGIN RSA PRIVATE KEY-----
|
42
|
+
MIIEpQIBAAKCAQEAt6G5YJC4x4UiRQB08dsLavDM92HVnQINs4fiAUgZsPICTAhb
|
43
|
+
Agn7XRXU+P8fX1aReRi2p4LHSItdl5hjT2WkNCH1Niw9fpltiNhnlOlrpoBt/eWM
|
44
|
+
dd2rJtC00jQ4pDv+1edw9pc+Re7fDQYD4HSmhm/expQLAgu+LSFCdL7Fj05OAN7D
|
45
|
+
0RxwFfQ3wrZe5qGt4tr5objA2wXwGEnMpFqFGGI9+uqSKnuw1aUgVf7iRvec1fJT
|
46
|
+
/hmFSastozEnBJmBB/mQoFvjOqz+oSiXmXiwvoHfw9B8AdbxKpmi4+AfSTmJqYT1
|
47
|
+
j4FPO6JJf78Qx0Uh7eWQcC7uxhLa5XpHr6C/qQIDAQABAoIBAAR18ULfQR3XphV3
|
48
|
+
BWA6qfRXFSONRNsjiaGq01qknbsmpdei/FL4WxrPxPSnfeOa/r2qVAWNr7mbaRKd
|
49
|
+
qQvstChwCrzeJkBFCdwhJaMAaJUK2aEpSlgyok23FC1nB1k1++LGVIAo/GJGgzSV
|
50
|
+
yNJTAxiQ7yBzyDCsiFogTLT5TWNFwSPOSWTbUQIMW0BGVnVlecB/VIJN1zrBZSAe
|
51
|
+
T/MZenbjybkuTuXWod09YS9Yvx17eG/21I11AwBcmc5MlAn9nkZbydQs6kbLd9hx
|
52
|
+
KT7d9c42ocrTVrmMBcF7S5W8BdMp90snNc7sG99sQJ4W5BL8a46i4kVf6yURh5dy
|
53
|
+
orDDdAECgYEA4wh/jPEcfW/gP1nE9ydLYvgz7tC6+sWR1I7519W15NFABzoW6cw6
|
54
|
+
wjyWhR61EMir9ylTEc5FPwGgodVFb9ctIE+MMH1JL5XGCvAf5J62Hy+O0QnN2bEp
|
55
|
+
rdSf02Huw+6+6S7VXU50SjazeIU2qJ77ti05ukEe8unG9QNlr+Mk7pkCgYEAzw+e
|
56
|
+
sydIVNdi4IJqiJgcikcaBB8V+CimTC1sPzF3/iDSW0LAWTqhdlZIv8My6O8V85go
|
57
|
+
LjNv2+4ODo3b5wFrDHZ8yFgEzMa2SUDz2EgS3MlpaIrfpqzbr8womAaCJr2RYzGZ
|
58
|
+
kh9LmvbDEjXJqsABnW6XG5wOnSYoajp8cztqU5ECgYEA3DHi3AUCN9rpKShc88WF
|
59
|
+
xXCrleWWZCB5ByrAwYiCSXJ14kyB6rJtDvSKnIQi4ytuNmM7MVrZKHngnPVnykht
|
60
|
+
eRgOBP2OnPtrwDITDL6uLuMGZlJW99tvbCx78x3Z4OjO+wS0ZjHwcgZJ3Qt+7t57
|
61
|
+
jb6hbbc5WCpLEFoCJyxsJokCgYEAyFmv0F/BMD6ccOogFP1CGFZGCRjfFBiZGHqX
|
62
|
+
E+pU1bOCd0V2gqAlnTBOAibo+tRkZCilMFca9C46scB3t+T6ZLu9b8kjE9VuiiDs
|
63
|
+
ESlj/vhwIvTFBSybAVZFLRyXEM86f0V9+BKKAG6mP9eFw883gNKCKffteAd08ZyX
|
64
|
+
0JP8BNECgYEAprEkF/YNMl+Se5V2Rz8jrpstlbwrF3M3QHa6UflmOcnQcLHXKU8B
|
65
|
+
PZdVDER5VyhZdTpTb5wHY3ZDkig3YV0xxdS6uhdG34Gj0M2G2DFMGAQeWEgfJDas
|
66
|
+
c2kwvmY7JQlTx0zrcpGcnFiW2kNyHToI7QiE/Q02BqIdHjr6lrSpu18=
|
67
|
+
-----END RSA PRIVATE KEY-----
|
68
|
+
headers:
|
69
|
+
Content-Type:
|
70
|
+
- application/octet-stream
|
71
|
+
X-Rundeck-Auth-Token:
|
72
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
73
|
+
Accept:
|
74
|
+
- application/xml
|
75
|
+
response:
|
76
|
+
status:
|
77
|
+
code: 200
|
78
|
+
message: OK
|
79
|
+
headers:
|
80
|
+
Set-Cookie:
|
81
|
+
- JSESSIONID=1qsjaz71clscrnnezkexp2emj;Path=/
|
82
|
+
Expires:
|
83
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
84
|
+
Content-Type:
|
85
|
+
- application/xml;charset=utf-8
|
86
|
+
Transfer-Encoding:
|
87
|
+
- chunked
|
88
|
+
Server:
|
89
|
+
- Jetty(7.6.0.v20120127)
|
90
|
+
body:
|
91
|
+
encoding: UTF-8
|
92
|
+
string: <resource path='keys/path/to/private_key2' type='file' url='http://192.168.50.2:4440/api/12/storage/keys/path/to/private_key2'
|
93
|
+
name='private_key2'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>1679</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-key-type>private</Rundeck-key-type></resource-meta></resource>
|
94
|
+
http_version:
|
95
|
+
recorded_at: Sat, 11 Oct 2014 19:13:33 GMT
|
96
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,70 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/storage/keys/path/to/public_key2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=10rz2p47fbf3j15ywegx7hjz49;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/xml;charset=utf-8
|
25
|
+
Transfer-Encoding:
|
26
|
+
- chunked
|
27
|
+
Server:
|
28
|
+
- Jetty(7.6.0.v20120127)
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: <resource path='keys/path/to/public_key2' type='file' url='http://192.168.50.2:4440/api/12/storage/keys/path/to/public_key2'
|
32
|
+
name='public_key2'><resource-meta><Rundeck-content-type>application/pgp-key</Rundeck-content-type><Rundeck-content-size>396</Rundeck-content-size></resource-meta></resource>
|
33
|
+
http_version:
|
34
|
+
recorded_at: Sat, 11 Oct 2014 19:22:19 GMT
|
35
|
+
- request:
|
36
|
+
method: put
|
37
|
+
uri: http://192.168.50.2:4440/api/12/storage/keys/path/to/public_key2
|
38
|
+
body:
|
39
|
+
encoding: UTF-8
|
40
|
+
string: |
|
41
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3oblgkLjHhSJFAHTx2wtq8Mz3YdWdAg2zh+IBSBmw8gJMCFsCCftdFdT4/x9fVpF5GLangsdIi12XmGNPZaQ0IfU2LD1+mW2I2GeU6WumgG395Yx13asm0LTSNDikO/7V53D2lz5F7t8NBgPgdKaGb97GlAsCC74tIUJ0vsWPTk4A3sPRHHAV9DfCtl7moa3i2vmhuMDbBfAYScykWoUYYj366pIqe7DVpSBV/uJG95zV8lP+GYVJqy2jMScEmYEH+ZCgW+M6rP6hKJeZeLC+gd/D0HwB1vEqmaLj4B9JOYmphPWPgU87okl/vxDHRSHt5ZBwLu7GEtrlekevoL+p test@localhost
|
42
|
+
headers:
|
43
|
+
Content-Type:
|
44
|
+
- application/pgp-key
|
45
|
+
X-Rundeck-Auth-Token:
|
46
|
+
- i8iMfXUOpYzVJ9SAkh7pRQMTZI1Bnsyu
|
47
|
+
Accept:
|
48
|
+
- application/xml
|
49
|
+
response:
|
50
|
+
status:
|
51
|
+
code: 200
|
52
|
+
message: OK
|
53
|
+
headers:
|
54
|
+
Set-Cookie:
|
55
|
+
- JSESSIONID=1n4mp826apr0fife3os4mgfy3;Path=/
|
56
|
+
Expires:
|
57
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
58
|
+
Content-Type:
|
59
|
+
- application/xml;charset=utf-8
|
60
|
+
Transfer-Encoding:
|
61
|
+
- chunked
|
62
|
+
Server:
|
63
|
+
- Jetty(7.6.0.v20120127)
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: <resource path='keys/path/to/public_key2' type='file' url='http://192.168.50.2:4440/api/12/storage/keys/path/to/public_key2'
|
67
|
+
name='public_key2'><resource-meta><Rundeck-content-type>application/pgp-key</Rundeck-content-type><Rundeck-content-size>396</Rundeck-content-size></resource-meta></resource>
|
68
|
+
http_version:
|
69
|
+
recorded_at: Sat, 11 Oct 2014 19:22:19 GMT
|
70
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,346 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rundeck::Client do
|
4
|
+
describe '.execute_job' do
|
5
|
+
context 'with all required options',
|
6
|
+
vcr: { cassette_name: 'run_job_valid' } do
|
7
|
+
before do
|
8
|
+
options = {
|
9
|
+
query: {
|
10
|
+
argString:
|
11
|
+
'-repository ci -release SNAPSHOT -packages app-SNAPSHOT'
|
12
|
+
}
|
13
|
+
}
|
14
|
+
@execute_job = Rundeck.run_job('2', options)
|
15
|
+
end
|
16
|
+
subject { @execute_job }
|
17
|
+
|
18
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
19
|
+
it { is_expected.to respond_to(:user) }
|
20
|
+
it { is_expected.to respond_to(:date_started) }
|
21
|
+
its(:job) { is_expected.to respond_to(:name) }
|
22
|
+
its(:job) { is_expected.to respond_to(:group) }
|
23
|
+
its(:job) { is_expected.to respond_to(:project) }
|
24
|
+
its(:job) { is_expected.to respond_to(:description) }
|
25
|
+
|
26
|
+
it 'expects a post to have been made' do
|
27
|
+
expect(
|
28
|
+
a_post('/job/2/executions?argString=-repository%20ci%20-release%20SNAPSHOT%20-packages%20app-SNAPSHOT')
|
29
|
+
).to have_been_made
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'without required options',
|
34
|
+
vcr: { cassette_name: 'run_job_invalid' } do
|
35
|
+
specify do
|
36
|
+
expect do
|
37
|
+
Rundeck.run_job('2')
|
38
|
+
end.to raise_error(Rundeck::Error::BadRequest,
|
39
|
+
/Job options were not valid:/)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Alias of execute job
|
45
|
+
describe '.run_job' do
|
46
|
+
subject { Rundeck }
|
47
|
+
|
48
|
+
it { is_expected.to respond_to(:run_job) }
|
49
|
+
end
|
50
|
+
|
51
|
+
# The anvils demo doesn't have any executions by default.
|
52
|
+
# Login and run the 'nightly_catalog_rebuild' job a few times.
|
53
|
+
describe '.job_executions', vcr: { cassette_name: 'job_executions' } do
|
54
|
+
before do
|
55
|
+
@job_executions = Rundeck.job_executions('1')
|
56
|
+
end
|
57
|
+
subject { @job_executions }
|
58
|
+
|
59
|
+
it { is_expected.to be_an Array }
|
60
|
+
|
61
|
+
it 'expects a get to have been made' do
|
62
|
+
expect(a_get('/job/1/executions')).to have_been_made
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# describe '.running_job_executions' do
|
67
|
+
# before do
|
68
|
+
# @running_jobs = Rundeck.running_job_executions('anvils')
|
69
|
+
# end
|
70
|
+
# subject { @running_jobs }
|
71
|
+
#
|
72
|
+
# context 'when there are multiple executions',
|
73
|
+
# vcr: { cassette_name: 'running_jobs_multiple' } do
|
74
|
+
# it { is_expected.to be_an Array }
|
75
|
+
# its('first') { is_expected.to respond_to(:user) }
|
76
|
+
# its('first') { is_expected.to respond_to(:date_started) }
|
77
|
+
# its('first') { is_expected.to respond_to(:job) }
|
78
|
+
#
|
79
|
+
# it 'expects a get to have been made' do
|
80
|
+
# expect(a_get('/executions/running?project=anvils')).to have_been_made
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# context 'when there is a single execution',
|
85
|
+
# vcr: { cassette_name: 'running_jobs_single' } do
|
86
|
+
# it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
87
|
+
# it { is_expected.to respond_to(:user) }
|
88
|
+
# it { is_expected.to respond_to(:date_started) }
|
89
|
+
# it { is_expected.to respond_to(:job) }
|
90
|
+
#
|
91
|
+
# it 'expects a get to have been made' do
|
92
|
+
# expect(a_get('/executions/running?project=anvils')).to have_been_made
|
93
|
+
# end
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# context 'when there are no running executions',
|
97
|
+
# vcr: { cassette_name: 'running_jobs_none' } do
|
98
|
+
# it { is_expected.to be_nil }
|
99
|
+
#
|
100
|
+
# it 'expects a get to have been made' do
|
101
|
+
# expect(a_get('/executions/running?project=anvils')).to have_been_made
|
102
|
+
# end
|
103
|
+
# end
|
104
|
+
# end
|
105
|
+
|
106
|
+
describe '.delete_job_executions' do
|
107
|
+
before do
|
108
|
+
@job_executions = Rundeck.delete_job_executions('1')
|
109
|
+
end
|
110
|
+
subject { @job_executions }
|
111
|
+
|
112
|
+
context 'when a job has executions',
|
113
|
+
vcr: { cassette_name: 'delete_job_executions' } do
|
114
|
+
|
115
|
+
it { is_expected.to respond_to(:successful) }
|
116
|
+
it { is_expected.to respond_to(:requestcount) }
|
117
|
+
|
118
|
+
it 'expects a delete to have been made' do
|
119
|
+
expect(a_delete('/job/1/executions')).to have_been_made
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context 'when a job does not have executions',
|
124
|
+
vcr: { cassette_name: 'delete_job_executions_invalid' } do
|
125
|
+
it { is_expected.to respond_to(:successful) }
|
126
|
+
its('successful.count') { is_expected.to eq('0') }
|
127
|
+
its(:allsuccessful) { is_expected.to eq('true') }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '.delete_execution' do
|
132
|
+
context 'when an execution exists',
|
133
|
+
vcr: { cassette_name: 'delete_execution_valid' } do
|
134
|
+
before do
|
135
|
+
@execution = Rundeck.delete_execution('1')
|
136
|
+
end
|
137
|
+
subject { @execution }
|
138
|
+
|
139
|
+
it { is_expected.to be_nil }
|
140
|
+
it 'expects a delete to have been made' do
|
141
|
+
expect(a_delete('/execution/1')).to have_been_made
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'when an execution does not exist',
|
146
|
+
vcr: { cassette_name: 'delete_execution_invalid' } do
|
147
|
+
specify do
|
148
|
+
expect do
|
149
|
+
Rundeck.delete_execution('123456')
|
150
|
+
end.to raise_error(Rundeck::Error::NotFound,
|
151
|
+
/Execution ID does not exist: 123456/)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe '.abort_execution' do
|
157
|
+
context 'with a valid execution id' do
|
158
|
+
before do
|
159
|
+
@execution = Rundeck.abort_execution(id)
|
160
|
+
end
|
161
|
+
subject { @execution }
|
162
|
+
|
163
|
+
context 'when the execution is running',
|
164
|
+
vcr: { cassette_name: 'abort_execution_valid' } do
|
165
|
+
let(:id) { '5' }
|
166
|
+
|
167
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
168
|
+
its('execution.id') { is_expected.to eq('5') }
|
169
|
+
its(:status) { is_expected.to eq('aborted') }
|
170
|
+
|
171
|
+
it 'expects a post to have been made' do
|
172
|
+
expect(a_post('/execution/5/abort')).to have_been_made
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'when the execution is not running',
|
177
|
+
vcr: { cassette_name: 'abort_execution_not_running' } do
|
178
|
+
let(:id) { '4' }
|
179
|
+
|
180
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
181
|
+
its('execution.id') { is_expected.to eq('4') }
|
182
|
+
its(:status) { is_expected.to eq('failed') }
|
183
|
+
its(:reason) { is_expected.to eq('Job is not running') }
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'when the execution does not exist',
|
188
|
+
vcr: { cassette_name: 'abort_executions_invalid' } do
|
189
|
+
specify do
|
190
|
+
expect do
|
191
|
+
Rundeck.abort_execution('123456')
|
192
|
+
end.to raise_error(Rundeck::Error::NotFound,
|
193
|
+
/Execution ID does not exist: 123456/)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe '.execution' do
|
199
|
+
context 'with a valid execution id',
|
200
|
+
vcr: { cassette_name: 'execution_valid' } do
|
201
|
+
before do
|
202
|
+
@execution = Rundeck.execution('15')
|
203
|
+
end
|
204
|
+
subject { @execution }
|
205
|
+
|
206
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
207
|
+
it { is_expected.to respond_to(:user) }
|
208
|
+
it { is_expected.to respond_to(:date_started) }
|
209
|
+
it { is_expected.to respond_to(:job) }
|
210
|
+
|
211
|
+
it 'expects a get to have been made' do
|
212
|
+
expect(a_get('/execution/15')).to have_been_made
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'with an invalid id',
|
217
|
+
vcr: { cassette_name: 'execution_invalid' } do
|
218
|
+
specify do
|
219
|
+
expect do
|
220
|
+
Rundeck.execution('2')
|
221
|
+
end.to raise_error(Rundeck::Error::NotFound,
|
222
|
+
/Execution ID does not exist:/)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe '.bulk_delete_executions' do
|
228
|
+
context 'with the correct parameters' do
|
229
|
+
before do
|
230
|
+
@executions = Rundeck.bulk_delete_executions(ids)
|
231
|
+
end
|
232
|
+
subject { @executions }
|
233
|
+
|
234
|
+
context 'with valid executions',
|
235
|
+
vcr: { cassette_name: 'bulk_delete_executions_valid' } do
|
236
|
+
let(:ids) { %w(3 4 5) }
|
237
|
+
|
238
|
+
its(:requestcount) { is_expected.to eq('3') }
|
239
|
+
its(:allsuccessful) { is_expected.to eq('true') }
|
240
|
+
its('successful.count') { is_expected.to eq('3') }
|
241
|
+
|
242
|
+
it 'expects a post to have been made' do
|
243
|
+
expect(a_post('/executions/delete?ids=3,4,5')).to have_been_made
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'with invalid executions',
|
248
|
+
vcr: { cassette_name: 'bulk_delete_executions_invalid' } do
|
249
|
+
let(:ids) { %w(1000 2000 3000) }
|
250
|
+
|
251
|
+
its(:requestcount) { is_expected.to eq('3') }
|
252
|
+
its('successful.count') { is_expected.to eq('0') }
|
253
|
+
its('failed.count') { is_expected.to eq('3') }
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
context 'with a non-array id' do
|
258
|
+
specify do
|
259
|
+
expect do
|
260
|
+
Rundeck.bulk_delete_executions('123')
|
261
|
+
end.to raise_error(Rundeck::Error::InvalidAttributes,
|
262
|
+
'`ids` must be an array of ids')
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
describe '.execution_state' do
|
268
|
+
context 'with a valid execution id',
|
269
|
+
vcr: { cassette_name: 'execution_state_valid' } do
|
270
|
+
before do
|
271
|
+
@state = Rundeck.execution_state('6')
|
272
|
+
end
|
273
|
+
subject { @state }
|
274
|
+
|
275
|
+
it { is_expected.to respond_to(:starttime) }
|
276
|
+
it { is_expected.to respond_to(:updatetime) }
|
277
|
+
it { is_expected.to respond_to(:steps) }
|
278
|
+
its(:executionid) { is_expected.to eq('6') }
|
279
|
+
its(:executionstate) { is_expected.to eq('SUCCEEDED') }
|
280
|
+
|
281
|
+
it 'expects a get to have been made' do
|
282
|
+
expect(a_get('/execution/6/state')).to have_been_made
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context 'with an invalid execution id',
|
287
|
+
vcr: { cassette_name: 'execution_state_invalid' } do
|
288
|
+
specify do
|
289
|
+
expect do
|
290
|
+
Rundeck.execution_state('123456')
|
291
|
+
end.to raise_error(Rundeck::Error::NotFound)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# describe '.execution_query' do
|
297
|
+
# before do
|
298
|
+
# @executions = Rundeck.execution_query(project, { query: query })
|
299
|
+
# end
|
300
|
+
# subject { @executions }
|
301
|
+
#
|
302
|
+
# context 'with a valid project id' do
|
303
|
+
# let(:project) { 'anvils' }
|
304
|
+
#
|
305
|
+
# context 'without any query parameters',
|
306
|
+
# vcr: { cassette_name: 'execution_query_no_params_valid' } do
|
307
|
+
# let(:query) { {} }
|
308
|
+
#
|
309
|
+
# its('count.to_i') { is_expected.to be > 0 }
|
310
|
+
# it { is_expected.to respond_to(:execution) }
|
311
|
+
#
|
312
|
+
# it 'expects a get to have been made' do
|
313
|
+
# expect(a_get('/executions?project=anvils')).to have_been_made
|
314
|
+
# end
|
315
|
+
# end
|
316
|
+
#
|
317
|
+
# context 'with query parameters',
|
318
|
+
# vcr: { cassette_name: 'execution_query_params_valid' } do
|
319
|
+
#
|
320
|
+
# it 'expects a get to have been made' do
|
321
|
+
# expect(a_get('/executions')).to have_been_made
|
322
|
+
# end
|
323
|
+
# end
|
324
|
+
# end
|
325
|
+
#
|
326
|
+
# context 'with an invalid project id',
|
327
|
+
# vcr: { cassette_name: 'execution_query_invalid' } do
|
328
|
+
# let(:project) { 'other_project' }
|
329
|
+
# let(:query) { {} }
|
330
|
+
#
|
331
|
+
# its(:count) { is_expected.to eq('0') }
|
332
|
+
#
|
333
|
+
# it 'expects a get to have been made' do
|
334
|
+
# expect(a_get('/executions?project=other_project')).to have_been_made
|
335
|
+
# end
|
336
|
+
# end
|
337
|
+
# end
|
338
|
+
|
339
|
+
describe '.execution_output' do
|
340
|
+
|
341
|
+
end
|
342
|
+
|
343
|
+
describe '.execution_output_with_state' do
|
344
|
+
|
345
|
+
end
|
346
|
+
end
|