rundeck 0.0.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://192.168.50.2:4440/api/12/tokens
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=yibh2tyfyj2g145fkj676ob7x;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
+ <tokens count='2' allusers='true'>
37
+ <token id='cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd' user='admin' />
38
+ <token id='uuyuaroo9Cheexe0ao9cohrohjeu8shu' user='user2' />
39
+ </tokens>
40
+ http_version:
41
+ recorded_at: Sun, 23 Nov 2014 15:24:02 GMT
42
+ 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/tokens
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=yibh2tyfyj2g145fkj676ob7x;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
+ <tokens count='1' allusers='true'>
37
+ <token id='cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd' user='admin' />
38
+ </tokens>
39
+ http_version:
40
+ recorded_at: Sun, 23 Nov 2014 15:24:02 GMT
41
+ 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/tokens/admin
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=1hrguobtwmxjgvyr55bwwd495;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
+ <tokens count='1' user='admin'>
37
+ <token id='cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd' user='admin' />
38
+ </tokens>
39
+ http_version:
40
+ recorded_at: Sun, 23 Nov 2014 15:36:11 GMT
41
+ recorded_with: VCR 2.9.3
@@ -11,22 +11,22 @@ describe Rundeck::Client do
11
11
  '-repository ci -release SNAPSHOT -packages app-SNAPSHOT'
12
12
  }
13
13
  }
14
- @execute_job = Rundeck.run_job('2', options)
14
+ @job = Rundeck.run_job('2', options)
15
15
  end
16
- subject { @execute_job }
16
+ subject { @job }
17
17
 
18
18
  its(:count) { is_expected.to eq('1') }
19
19
 
20
20
  describe '#execution' do
21
- subject { @execute_job.execution }
21
+ subject { @job.execution }
22
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) }
23
+ it_behaves_like 'an execution'
24
+
25
+ describe '#job' do
26
+ subject { @job.execution.job }
27
+
28
+ it_behaves_like 'a job with a project attribute'
29
+ end
30
30
  end
31
31
 
32
32
  it 'expects a post to have been made' do
@@ -72,13 +72,13 @@ describe Rundeck::Client do
72
72
  context '#first' do
73
73
  subject { @job_executions.execution[0] }
74
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) }
75
+ it_behaves_like 'a past execution'
76
+
77
+ describe '#job' do
78
+ subject { @job_executions.execution[0].job }
79
+
80
+ it_behaves_like 'a job with a project attribute'
81
+ end
82
82
  end
83
83
  end
84
84
 
@@ -101,9 +101,12 @@ describe Rundeck::Client do
101
101
  subject { @running_jobs.execution }
102
102
 
103
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) }
104
+
105
+ context 'the first execution' do
106
+ subject { @running_jobs.execution[0] }
107
+
108
+ it_behaves_like 'an execution'
109
+ end
107
110
  end
108
111
 
109
112
  it 'expects a get to have been made' do
@@ -118,10 +121,7 @@ describe Rundeck::Client do
118
121
  describe '#execution' do
119
122
  subject { @running_jobs.execution }
120
123
 
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) }
124
+ it_behaves_like 'an execution'
125
125
  end
126
126
 
127
127
  it 'expects a get to have been made' do
@@ -150,6 +150,7 @@ describe Rundeck::Client do
150
150
  vcr: { cassette_name: 'delete_job_executions' } do
151
151
 
152
152
  it { is_expected.to respond_to(:successful) }
153
+ it { is_expected.to respond_to(:allsuccessful) }
153
154
  it { is_expected.to respond_to(:requestcount) }
154
155
 
155
156
  it 'expects a delete to have been made' do
@@ -159,9 +160,14 @@ describe Rundeck::Client do
159
160
 
160
161
  context 'when a job does not have executions',
161
162
  vcr: { cassette_name: 'delete_job_executions_invalid' } do
162
- it { is_expected.to respond_to(:successful) }
163
- its('successful.count') { is_expected.to eq('0') }
164
163
  its(:allsuccessful) { is_expected.to eq('true') }
164
+ its(:requestcount) { is_expected.to eq('0') }
165
+
166
+ describe '#successful' do
167
+ subject { @job_executions.successful }
168
+
169
+ its(:count) { is_expected.to eq('0') }
170
+ end
165
171
  end
166
172
  end
167
173
 
@@ -202,9 +208,14 @@ describe Rundeck::Client do
202
208
  let(:id) { '5' }
203
209
 
204
210
  it { is_expected.to be_a Rundeck::ObjectifiedHash }
205
- its('execution.id') { is_expected.to eq('5') }
206
211
  its(:status) { is_expected.to eq('aborted') }
207
212
 
213
+ describe '#execution' do
214
+ subject { @execution.execution }
215
+
216
+ it { is_expected.to respond_to(:id) }
217
+ end
218
+
208
219
  it 'expects a post to have been made' do
209
220
  expect(a_post('/execution/5/abort')).to have_been_made
210
221
  end
@@ -215,9 +226,14 @@ describe Rundeck::Client do
215
226
  let(:id) { '4' }
216
227
 
217
228
  it { is_expected.to be_a Rundeck::ObjectifiedHash }
218
- its('execution.id') { is_expected.to eq('4') }
219
229
  its(:status) { is_expected.to eq('failed') }
220
230
  its(:reason) { is_expected.to eq('Job is not running') }
231
+
232
+ describe '#execution' do
233
+ subject { @execution.execution }
234
+
235
+ it { is_expected.to respond_to(:id) }
236
+ end
221
237
  end
222
238
  end
223
239
 
@@ -240,10 +256,13 @@ describe Rundeck::Client do
240
256
  end
241
257
  subject { @execution }
242
258
 
243
- it { is_expected.to be_a Rundeck::ObjectifiedHash }
244
- it { is_expected.to respond_to(:user) }
245
- it { is_expected.to respond_to(:date_started) }
246
- it { is_expected.to respond_to(:job) }
259
+ it_behaves_like 'a past execution'
260
+
261
+ describe '#job' do
262
+ subject { @execution.job }
263
+
264
+ it_behaves_like 'a job with a project attribute'
265
+ end
247
266
 
248
267
  it 'expects a get to have been made' do
249
268
  expect(a_get('/execution/15')).to have_been_made
@@ -274,7 +293,12 @@ describe Rundeck::Client do
274
293
 
275
294
  its(:requestcount) { is_expected.to eq('3') }
276
295
  its(:allsuccessful) { is_expected.to eq('true') }
277
- its('successful.count') { is_expected.to eq('3') }
296
+
297
+ describe '#successful' do
298
+ subject { @executions.successful }
299
+
300
+ it { is_expected.to respond_to(:count) }
301
+ end
278
302
 
279
303
  it 'expects a post to have been made' do
280
304
  expect(a_post('/executions/delete?ids=3,4,5')).to have_been_made
@@ -343,9 +367,31 @@ describe Rundeck::Client do
343
367
  vcr: { cassette_name: 'execution_query_no_params_valid' } do
344
368
  let(:query) { {} }
345
369
 
346
- its('count.to_i') { is_expected.to be > 0 }
347
370
  it { is_expected.to respond_to(:execution) }
348
- its(:execution) { is_expected.to be_an Array }
371
+
372
+ describe '#count' do
373
+ subject { @executions.count.to_i }
374
+
375
+ it { is_expected.to be > 0 }
376
+ end
377
+
378
+ describe '#execution' do
379
+ subject { @executions.execution }
380
+
381
+ it { is_expected.to be_an Array }
382
+
383
+ context 'the first execution' do
384
+ subject { @executions.execution[0] }
385
+
386
+ it_behaves_like 'an execution'
387
+
388
+ describe '#job' do
389
+ subject { @executions.execution[0].job }
390
+
391
+ it_behaves_like 'a job with a project attribute'
392
+ end
393
+ end
394
+ end
349
395
 
350
396
  it 'expects a get to have been made' do
351
397
  expect(a_get('/executions?project=anvils')).to have_been_made
@@ -15,11 +15,12 @@ describe Rundeck::Client do
15
15
  it { is_expected.to be_an Array }
16
16
  its(:length) { is_expected.to eq(6) }
17
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) }
18
+ context 'the first job' do
19
+ subject { @jobs.job[0] }
20
+
21
+ it_behaves_like 'a job'
22
+ its(:project) { is_expected.to eq('anvils') }
23
+ end
23
24
  end
24
25
 
25
26
  it 'expects a get to have been made' do
@@ -33,13 +34,28 @@ describe Rundeck::Client do
33
34
  end
34
35
  subject { @job }
35
36
 
36
- it { is_expected.to be_a Rundeck::ObjectifiedHash }
37
- it { is_expected.to respond_to(:id) }
38
- it { is_expected.to respond_to(:name) }
39
- it { is_expected.to respond_to(:description) }
40
- it { is_expected.to respond_to(:loglevel) }
41
- it { is_expected.to respond_to(:sequence) }
42
- its(:sequence) { is_expected.to respond_to(:command) }
37
+ it_behaves_like 'a job'
38
+ its(:loglevel) { is_expected.to eq('INFO') }
39
+
40
+ describe '#context' do
41
+ subject { @job.context }
42
+
43
+ its(:project) { is_expected.to eq('anvils') }
44
+ end
45
+
46
+ describe '#sequence' do
47
+ subject { @job.sequence }
48
+
49
+ it { is_expected.to respond_to(:keepgoing) }
50
+ it { is_expected.to respond_to(:strategy) }
51
+
52
+ describe '#command' do
53
+ subject { @job.sequence.command }
54
+
55
+ it { is_expected.to respond_to(:scriptargs) }
56
+ it { is_expected.to respond_to(:script) }
57
+ end
58
+ end
43
59
 
44
60
  it 'expects a get to have been made' do
45
61
  expect(a_get('/job/2')).to have_been_made
@@ -76,24 +92,28 @@ describe Rundeck::Client do
76
92
  describe '.import_job' do
77
93
  context 'with valid format' do
78
94
  before do
79
- @import = Rundeck.import_jobs(content, format)
95
+ @job_import = Rundeck.import_jobs(content, format)
80
96
  end
81
- subject { @import }
97
+ subject { @job_import }
82
98
 
83
99
  context 'yaml', vcr: { cassette_name: 'import_job_yaml' } do
84
100
  let(:format) { 'yaml' }
85
101
  let(:content) { job_yaml }
86
102
 
87
103
  it { is_expected.to be_a Rundeck::ObjectifiedHash }
88
- its('succeeded.count') { is_expected.to eq('1') }
89
104
  its('failed.count') { is_expected.to eq('0') }
90
105
 
91
- its('succeeded') { is_expected.to respond_to(:job) }
92
- its('succeeded.job') { is_expected.to respond_to(:id) }
93
- its('succeeded.job') { is_expected.to respond_to(:name) }
94
- its('succeeded.job') { is_expected.to respond_to(:group) }
95
- its('succeeded.job') { is_expected.to respond_to(:project) }
96
- its('succeeded.job') { is_expected.to respond_to(:url) }
106
+ describe '#succeeded' do
107
+ subject { @job_import.succeeded }
108
+
109
+ its(:count) { is_expected.to eq('1') }
110
+
111
+ describe '#job' do
112
+ subject { @job_import.succeeded.job }
113
+
114
+ it_behaves_like 'a job import'
115
+ end
116
+ end
97
117
 
98
118
  it 'expects a post to have been made' do
99
119
  expect(a_post('/jobs/import?format=yaml')).to have_been_made
@@ -105,15 +125,18 @@ describe Rundeck::Client do
105
125
  let(:content) { job_xml }
106
126
 
107
127
  it { is_expected.to be_a Rundeck::ObjectifiedHash }
108
- its('succeeded.count') { is_expected.to eq('1') }
109
128
  its('failed.count') { is_expected.to eq('0') }
110
129
 
111
- its('succeeded') { is_expected.to respond_to(:job) }
112
- its('succeeded.job') { is_expected.to respond_to(:id) }
113
- its('succeeded.job') { is_expected.to respond_to(:name) }
114
- its('succeeded.job') { is_expected.to respond_to(:group) }
115
- its('succeeded.job') { is_expected.to respond_to(:project) }
116
- its('succeeded.job') { is_expected.to respond_to(:url) }
130
+ describe '#succeeded' do
131
+ subject { @job_import.succeeded }
132
+ its(:count) { is_expected.to eq('1') }
133
+
134
+ describe '#job' do
135
+ subject { @job_import.succeeded.job }
136
+
137
+ it_behaves_like 'a job import'
138
+ end
139
+ end
117
140
 
118
141
  it 'expects a post to have been made' do
119
142
  expect(a_post('/jobs/import?format=xml')).to have_been_made
@@ -14,8 +14,21 @@ describe Rundeck::Client do
14
14
  subject { @keys }
15
15
 
16
16
  it { is_expected.to be_an Array }
17
- its('first.name') { is_expected.to eq('key') }
18
- its('first.resource_meta.rundeck_content_type') { is_expected.to eq('application/pgp-key') }
17
+
18
+ context 'the first key' do
19
+ subject { @keys.first }
20
+
21
+ its(:name) { is_expected.to eq('key') }
22
+ its(:type) { is_expected.to eq('file') }
23
+ it { is_expected.to respond_to(:url) }
24
+ it { is_expected.to respond_to(:path) }
25
+
26
+ describe '#resource_meta' do
27
+ subject { @keys.first.resource_meta }
28
+
29
+ its(:rundeck_content_type) { is_expected.to eq('application/pgp-key') }
30
+ end
31
+ end
19
32
 
20
33
  it 'expects a get to have been made' do
21
34
  expect(a_get('/storage/keys/path/to')).to have_been_made