rundeck 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: http://192.168.50.2:4440/api/12/project/anvils
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Rundeck-Auth-Token:
11
+ - cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
12
+ Accept:
13
+ - application/xml
14
+ response:
15
+ status:
16
+ code: 204
17
+ message: No Content
18
+ headers:
19
+ Set-Cookie:
20
+ - JSESSIONID=h9bppwj9mk20c3su28yyj9v0;Path=/
21
+ Expires:
22
+ - Thu, 01 Jan 1970 00:00:00 GMT
23
+ Content-Type:
24
+ - text/html;charset=UTF-8
25
+ Server:
26
+ - Jetty(7.6.0.v20120127)
27
+ body:
28
+ encoding: UTF-8
29
+ string: ''
30
+ http_version:
31
+ recorded_at: Sun, 02 Nov 2014 18:46:20 GMT
32
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://192.168.50.2:4440/api/12/project/nonexistent
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Rundeck-Auth-Token:
11
+ - cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
12
+ Accept:
13
+ - application/xml
14
+ response:
15
+ status:
16
+ code: 404
17
+ message: Not Found
18
+ headers:
19
+ Set-Cookie:
20
+ - JSESSIONID=7gqz90xxaj081m4rig5949nxn;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 error='true' apiversion='12'>
35
+ <error code='api.error.item.doesnotexist'>
36
+ <message>project does not exist: nonexistent</message>
37
+ </error>
38
+ </result>
39
+ http_version:
40
+ recorded_at: Sun, 02 Nov 2014 18:39:39 GMT
41
+ 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/project/anvils
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Rundeck-Auth-Token:
11
+ - cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
12
+ Accept:
13
+ - application/xml
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Set-Cookie:
20
+ - JSESSIONID=19y3li5pw7qg61i5gch7g94hab;Path=/
21
+ Expires:
22
+ - Thu, 01 Jan 1970 00:00:00 GMT
23
+ X-Rundeck-Api-Xml-Response-Wrapper:
24
+ - 'false'
25
+ Content-Type:
26
+ - application/xml;charset=UTF-8
27
+ X-Rundeck-Api-Version:
28
+ - '12'
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Server:
32
+ - Jetty(7.6.0.v20120127)
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ <project url='http://192.168.50.2:4440/api/12/project/anvils'>
37
+ <name>anvils</name>
38
+ <description></description>
39
+ <config>
40
+ <property key='project.name' value='anvils' />
41
+ <property key='project.ssh-authentication' value='privateKey' />
42
+ <property key='resources.source.2.config.directory' value='/var/rundeck/projects/anvils/etc/resources.d' />
43
+ <property key='resources.source.2.type' value='directory' />
44
+ <property key='service.NodeExecutor.default.provider' value='jsch-ssh' />
45
+ <property key='resources.source.1.config.includeServerNode' value='true' />
46
+ <property key='resources.source.1.config.generateFileAutomatically' value='true' />
47
+ <property key='resources.source.1.config.file' value='/var/rundeck/projects/anvils/etc/resources.xml' />
48
+ <property key='project.ssh-keypath' value='/var/lib/rundeck/.ssh/id_rsa' />
49
+ <property key='service.FileCopier.default.provider' value='jsch-scp' />
50
+ <property key='resources.source.1.type' value='file' />
51
+ </config>
52
+ </project>
53
+ http_version:
54
+ recorded_at: Sun, 02 Nov 2014 18:36:16 GMT
55
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://192.168.50.2:4440/api/12/projects
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Rundeck-Auth-Token:
11
+ - cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
12
+ Accept:
13
+ - application/xml
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Set-Cookie:
20
+ - JSESSIONID=jdrjk0hpsehg8rdfzj4a4ssy;Path=/
21
+ Expires:
22
+ - Thu, 01 Jan 1970 00:00:00 GMT
23
+ X-Rundeck-Api-Xml-Response-Wrapper:
24
+ - 'false'
25
+ Content-Type:
26
+ - application/xml;charset=UTF-8
27
+ X-Rundeck-Api-Version:
28
+ - '12'
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Server:
32
+ - Jetty(7.6.0.v20120127)
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ <projects count='1'>
37
+ <project url='http://192.168.50.2:4440/api/12/project/anvils'>
38
+ <name>anvils</name>
39
+ <description></description>
40
+ </project>
41
+ </projects>
42
+ http_version:
43
+ recorded_at: Fri, 31 Oct 2014 21:02:49 GMT
44
+ recorded_with: VCR 2.9.3
@@ -15,13 +15,19 @@ describe Rundeck::Client do
15
15
  end
16
16
  subject { @execute_job }
17
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) }
18
+ its(:count) { is_expected.to eq('1') }
19
+
20
+ describe '#execution' do
21
+ subject { @execute_job.execution }
22
+
23
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
24
+ it { is_expected.to respond_to(:user) }
25
+ it { is_expected.to respond_to(:date_started) }
26
+ its(:job) { is_expected.to respond_to(:name) }
27
+ its(:job) { is_expected.to respond_to(:group) }
28
+ its(:job) { is_expected.to respond_to(:project) }
29
+ its(:job) { is_expected.to respond_to(:description) }
30
+ end
25
31
 
26
32
  it 'expects a post to have been made' do
27
33
  expect(
@@ -56,52 +62,83 @@ describe Rundeck::Client do
56
62
  end
57
63
  subject { @job_executions }
58
64
 
59
- it { is_expected.to be_an Array }
65
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
66
+
67
+ describe '#execution' do
68
+ subject { @job_executions.execution }
69
+
70
+ it { is_expected.to be_an Array }
71
+
72
+ context '#first' do
73
+ subject { @job_executions.execution[0] }
74
+
75
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
76
+ it { is_expected.to respond_to(:user) }
77
+ it { is_expected.to respond_to(:date_started) }
78
+ its(:job) { is_expected.to respond_to(:name) }
79
+ its(:job) { is_expected.to respond_to(:group) }
80
+ its(:job) { is_expected.to respond_to(:project) }
81
+ its(:job) { is_expected.to respond_to(:description) }
82
+ end
83
+ end
60
84
 
61
85
  it 'expects a get to have been made' do
62
86
  expect(a_get('/job/1/executions')).to have_been_made
63
87
  end
64
88
  end
65
89
 
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
90
+ describe '.running_job_executions' do
91
+ before do
92
+ @running_jobs = Rundeck.running_job_executions('anvils')
93
+ end
94
+ subject { @running_jobs }
95
+
96
+ context 'when there are multiple executions',
97
+ vcr: { cassette_name: 'running_jobs_multiple' } do
98
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
99
+
100
+ describe '#execution' do
101
+ subject { @running_jobs.execution }
102
+
103
+ it { is_expected.to be_an Array }
104
+ its('first') { is_expected.to respond_to(:user) }
105
+ its('first') { is_expected.to respond_to(:date_started) }
106
+ its('first') { is_expected.to respond_to(:job) }
107
+ end
108
+
109
+ it 'expects a get to have been made' do
110
+ expect(a_get('/executions/running?project=anvils')).to have_been_made
111
+ end
112
+ end
113
+
114
+ context 'when there is a single execution',
115
+ vcr: { cassette_name: 'running_jobs_single' } do
116
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
117
+
118
+ describe '#execution' do
119
+ subject { @running_jobs.execution }
120
+
121
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
122
+ it { is_expected.to respond_to(:user) }
123
+ it { is_expected.to respond_to(:date_started) }
124
+ it { is_expected.to respond_to(:job) }
125
+ end
126
+
127
+ it 'expects a get to have been made' do
128
+ expect(a_get('/executions/running?project=anvils')).to have_been_made
129
+ end
130
+ end
131
+
132
+ context 'when there are no running executions',
133
+ vcr: { cassette_name: 'running_jobs_none' } do
134
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
135
+ its(:count) { is_expected.to eq('0') }
136
+
137
+ it 'expects a get to have been made' do
138
+ expect(a_get('/executions/running?project=anvils')).to have_been_made
139
+ end
140
+ end
141
+ end
105
142
 
106
143
  describe '.delete_job_executions' do
107
144
  before do
@@ -293,48 +330,50 @@ describe Rundeck::Client do
293
330
  end
294
331
  end
295
332
 
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
333
+ describe '.execution_query' do
334
+ before do
335
+ @executions = Rundeck.execution_query(project, query: query)
336
+ end
337
+ subject { @executions }
338
+
339
+ context 'with a valid project id' do
340
+ let(:project) { 'anvils' }
341
+
342
+ context 'without any query parameters',
343
+ vcr: { cassette_name: 'execution_query_no_params_valid' } do
344
+ let(:query) { {} }
345
+
346
+ its('count.to_i') { is_expected.to be > 0 }
347
+ it { is_expected.to respond_to(:execution) }
348
+ its(:execution) { is_expected.to be_an Array }
349
+
350
+ it 'expects a get to have been made' do
351
+ expect(a_get('/executions?project=anvils')).to have_been_made
352
+ end
353
+ end
354
+
355
+ # context 'with query parameters',
356
+ # vcr: { cassette_name: 'execution_query_params_valid' } do
357
+ # let(:query) { }
358
+ #
359
+ # it 'expects a get to have been made' do
360
+ # expect(a_get('/executions')).to have_been_made
361
+ # end
362
+ # end
363
+ end
364
+
365
+ context 'with an invalid project id',
366
+ vcr: { cassette_name: 'execution_query_invalid' } do
367
+ let(:project) { 'other_project' }
368
+ let(:query) { {} }
369
+
370
+ its(:count) { is_expected.to eq('0') }
371
+
372
+ it 'expects a get to have been made' do
373
+ expect(a_get('/executions?project=other_project')).to have_been_made
374
+ end
375
+ end
376
+ end
338
377
 
339
378
  describe '.execution_output' do
340
379
 
@@ -7,14 +7,20 @@ describe Rundeck::Client do
7
7
  end
8
8
  subject { @jobs }
9
9
 
10
- it { is_expected.to be_an Array }
11
- its(:length) { is_expected.to eq(6) }
12
-
13
- # Only tests the first element, but it's just a sanity check
14
- its('first') { is_expected.to respond_to(:name) }
15
- its('first') { is_expected.to respond_to(:group) }
16
- its('first') { is_expected.to respond_to(:project) }
17
- its('first') { is_expected.to respond_to(:description) }
10
+ it { is_expected.to be_a Rundeck::ObjectifiedHash }
11
+
12
+ describe '#job' do
13
+ subject { @jobs.job }
14
+
15
+ it { is_expected.to be_an Array }
16
+ its(:length) { is_expected.to eq(6) }
17
+
18
+ # Only tests the first element, but it's just a sanity check
19
+ its('first') { is_expected.to respond_to(:name) }
20
+ its('first') { is_expected.to respond_to(:group) }
21
+ its('first') { is_expected.to respond_to(:project) }
22
+ its('first') { is_expected.to respond_to(:description) }
23
+ end
18
24
 
19
25
  it 'expects a get to have been made' do
20
26
  expect(a_get('/project/anvils/jobs')).to have_been_made