serverspec-extra-types 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rspec +0 -0
  4. data/.rubocop.yml +0 -0
  5. data/.travis.yml +0 -0
  6. data/CODE_OF_CONDUCT.md +0 -0
  7. data/Gemfile +0 -0
  8. data/LICENSE.txt +0 -0
  9. data/README.md +657 -4
  10. data/Rakefile +0 -0
  11. data/bin/consul_gen.rb +115 -0
  12. data/bin/http_doc_gem.rb +67 -0
  13. data/http_matchers.md +1771 -0
  14. data/lib/serverspec_extra_types.rb +0 -0
  15. data/lib/serverspec_extra_types/helpers/properties.rb +0 -0
  16. data/lib/serverspec_extra_types/matchers.rb +4 -0
  17. data/lib/serverspec_extra_types/matchers/allowed_to_run_anything.rb +38 -0
  18. data/lib/serverspec_extra_types/matchers/allowed_to_run_command.rb +40 -0
  19. data/lib/serverspec_extra_types/matchers/be_a_manager_node.rb +0 -0
  20. data/lib/serverspec_extra_types/matchers/be_a_worker_node.rb +0 -0
  21. data/lib/serverspec_extra_types/matchers/be_active.rb +0 -0
  22. data/lib/serverspec_extra_types/matchers/configure_queue.rb +0 -0
  23. data/lib/serverspec_extra_types/matchers/have_count.rb +0 -0
  24. data/lib/serverspec_extra_types/matchers/have_domain_name.rb +0 -0
  25. data/lib/serverspec_extra_types/matchers/have_engine_version.rb +0 -0
  26. data/lib/serverspec_extra_types/matchers/have_environment_variable.rb +0 -0
  27. data/lib/serverspec_extra_types/matchers/have_ha_mode.rb +0 -0
  28. data/lib/serverspec_extra_types/matchers/have_ha_nodes.rb +0 -0
  29. data/lib/serverspec_extra_types/matchers/have_ha_sync_mode.rb +0 -0
  30. data/lib/serverspec_extra_types/matchers/have_host.rb +0 -0
  31. data/lib/serverspec_extra_types/matchers/have_hostname.rb +0 -0
  32. data/lib/serverspec_extra_types/matchers/have_image.rb +4 -0
  33. data/lib/serverspec_extra_types/matchers/have_image_sha.rb +0 -0
  34. data/lib/serverspec_extra_types/matchers/have_label.rb +0 -0
  35. data/lib/serverspec_extra_types/matchers/have_mount.rb +0 -0
  36. data/lib/serverspec_extra_types/matchers/have_network.rb +0 -0
  37. data/lib/serverspec_extra_types/matchers/have_placement_constraint.rb +0 -0
  38. data/lib/serverspec_extra_types/matchers/have_replica_count.rb +0 -0
  39. data/lib/serverspec_extra_types/matchers/have_restart_limit.rb +0 -0
  40. data/lib/serverspec_extra_types/matchers/have_restart_policy.rb +0 -0
  41. data/lib/serverspec_extra_types/matchers/have_user.rb +0 -0
  42. data/lib/serverspec_extra_types/matchers/have_vhost.rb +0 -0
  43. data/lib/serverspec_extra_types/matchers/http_1xx.rb +0 -0
  44. data/lib/serverspec_extra_types/matchers/http_2xx.rb +0 -0
  45. data/lib/serverspec_extra_types/matchers/http_3xx.rb +0 -0
  46. data/lib/serverspec_extra_types/matchers/http_4xx.rb +0 -0
  47. data/lib/serverspec_extra_types/matchers/http_5xx.rb +0 -0
  48. data/lib/serverspec_extra_types/matchers/include_regex.rb +0 -0
  49. data/lib/serverspec_extra_types/matchers/map_port.rb +0 -0
  50. data/lib/serverspec_extra_types/matchers/mirror_all.rb +0 -0
  51. data/lib/serverspec_extra_types/matchers/publish_all_ports.rb +0 -0
  52. data/lib/serverspec_extra_types/matchers/read_from_queue.rb +0 -0
  53. data/lib/serverspec_extra_types/matchers/url_matchers.rb +0 -0
  54. data/lib/serverspec_extra_types/matchers/write_to_queue.rb +0 -0
  55. data/lib/serverspec_extra_types/types.rb +2 -1
  56. data/lib/serverspec_extra_types/types/api_base.rb +10 -1
  57. data/lib/serverspec_extra_types/types/consul_base.rb +6 -2
  58. data/lib/serverspec_extra_types/types/consul_node.rb +21 -1
  59. data/lib/serverspec_extra_types/types/consul_node_list.rb +1 -1
  60. data/lib/serverspec_extra_types/types/consul_service.rb +188 -1
  61. data/lib/serverspec_extra_types/types/consul_service_list.rb +0 -0
  62. data/lib/serverspec_extra_types/types/curl.rb +5 -1
  63. data/lib/serverspec_extra_types/types/docker_config.rb +55 -0
  64. data/lib/serverspec_extra_types/types/docker_container.rb +0 -0
  65. data/lib/serverspec_extra_types/types/docker_network.rb +74 -1
  66. data/lib/serverspec_extra_types/types/docker_node.rb +12 -0
  67. data/lib/serverspec_extra_types/types/docker_secret.rb +56 -0
  68. data/lib/serverspec_extra_types/types/docker_service.rb +0 -0
  69. data/lib/serverspec_extra_types/types/rabbitmq_base.rb +7 -1
  70. data/lib/serverspec_extra_types/types/rabbitmq_node_list.rb +5 -1
  71. data/lib/serverspec_extra_types/types/rabbitmq_user_permission.rb +0 -0
  72. data/lib/serverspec_extra_types/types/rabbitmq_vhost_list.rb +4 -0
  73. data/lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb +0 -0
  74. data/lib/serverspec_extra_types/types/sudo_user.rb +90 -0
  75. data/lib/serverspec_extra_types/version.rb +1 -1
  76. data/properties.yml +45 -7
  77. data/serverspec-extra-types.gemspec +4 -1
  78. metadata +55 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9871554cee1e99974ee8a9451431e45e8b1180e662af105cbb8826c425e844ab
4
- data.tar.gz: 7c39e3df4f74009bef23ec749de84fd503316bd801c30285c691cb82381c67ba
3
+ metadata.gz: 16114f68b564482a2f0b4750487c3e33dc039004f97d07ef5c72777ea8214b8e
4
+ data.tar.gz: a8e65a89904623a18dcc544db127cae571affe9711dc0f078260028c31b9ea74
5
5
  SHA512:
6
- metadata.gz: acf7c2ec5e23016e9cceb9b512b74741751e94ae0edd81f6f2c465b1c42e9397ac94671fada28fd91681868e45b62dbb250ccb09645555b1e431d2f06dcedba6
7
- data.tar.gz: 3b65d22fe772c761819d94c2f452a8961d9ac72cab079bb01cc04e51ca5b85fb2c8fe730257e84525f47b9ef26231eeed1a5883725e7ee74e60609b890706c3f
6
+ metadata.gz: b1cdca60ba8b2d0a6490c5e01620561dd125ca4addd6a77d110491004e65bea53504c5e937fb1edd69d4b4223f24da60edb709310e86f4a89f72ede330eaca15
7
+ data.tar.gz: 529d8ad17b81bf97d75a61912e3bd7ec48dfcf6474c6528f290fec02db185b1cc9d94344fb6ab33125885f8bb090a4def5f455d613fa282a06821f7af165f940
data/.gitignore CHANGED
@@ -10,4 +10,6 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  Gemfile.lock
13
- .vagrant/
13
+ .vagrant/
14
+ tmp/
15
+ leek
data/.rspec CHANGED
File without changes
data/.rubocop.yml CHANGED
File without changes
data/.travis.yml CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -24,10 +24,273 @@ And then execute:
24
24
  Or install it yourself as:
25
25
 
26
26
  $ gem install serverspec-extra-types
27
-
28
27
  ## Usage
29
28
 
30
- ### docker_container
29
+ Add the following to your spec_helper.rb
30
+
31
+ ```ruby
32
+ require 'serverspec-extra-types'
33
+ ```
34
+
35
+ ## Resource types
36
+ [curl](#curl) |
37
+ [consul_node](#consul_node) | [consul_node_list](#consul_node_list) | [consul_service](#consul_service) |
38
+ [consul_service_list](#consul_service_list) |
39
+ [docker_config](#docker_config) | [docker_container](#docker_container) | [docker_network](#docker_network) |
40
+ [docker_node](#docker_node) | [docker_secret](#docker_secret) | [docker_service](#docker_service) |
41
+ [jenkins_credential](#jenkins_credential) |[jenkins_job](#jenkins_job) | [jenkins_plugin](#jenkins_plugin) |
42
+ [nfs_export](#nfs_export) |
43
+ [rabbitmq_node_list](#rabbitmq_node_list) | [rabbitmq_user_permission](#rabbitmq_user_permission) |
44
+ [rabbitmq_vhost_list](#rabbitmq_vhost_list) | [rabbitmq_vhost_policy](#rabbitmq_vhost_policy) | [sudo_user](#sudo_user)
45
+
46
+ ### curl <a name="curl" ></a>
47
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
48
+
49
+ The curl resource allow for check against remote url. Addition parameters are avaliable to allow for insecure certifactes and follow redirects
50
+
51
+ Example:
52
+ ```ruby
53
+ describe curl("https://example.org") do
54
+ it { should respond_with_OK }
55
+ end
56
+
57
+ #Without certificate verification
58
+ describe curl("https://example.org", insecure: true) do
59
+ it { should respond_with_OK }
60
+ end
61
+
62
+ #Following redirects
63
+ describe curl("https://example.org", follow_redirects: true) do
64
+ it { should respond_with_OK }
65
+ end
66
+ ```
67
+
68
+ For a full list of HTTP matchers see [HTTP Matchers](http_matchers.md)
69
+
70
+ ### consul_node <a name="consul_node" ></a>
71
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
72
+ ##### have_datacenter
73
+ ```ruby
74
+ describe consul_node('consul') do
75
+ it { should have_datacenter 'dc1'}
76
+ end
77
+ ```
78
+
79
+ ##### have_service
80
+ ```ruby
81
+ describe consul_node('consul') do
82
+ it { should have_datacenter 'dc1'}
83
+ end
84
+ ```
85
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
86
+ ### consul_node_list <a name="consul_node_list" ></a>
87
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
88
+ ##### have_node
89
+ ```ruby
90
+ describe consul_node_list() do
91
+ it { should have_node 'consul' }
92
+ end
93
+ ```
94
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
95
+ ### consul_service <a name="consul_service" ></a>
96
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
97
+ #### have_id
98
+ ```ruby
99
+ describe consul_service('consul') do
100
+ it { should have_id('7ba9a647-0adb-8c92-b0c9-5b011b3530a8') }
101
+ end
102
+ ```
103
+
104
+ #### have_node
105
+ ```ruby
106
+ describe consul_service('consul') do
107
+ it { should have_node('consul') }
108
+ end
109
+ ```
110
+
111
+ #### have_address
112
+ ```ruby
113
+ describe consul_service('consul') do
114
+ it { should have_address('127.0.0.1') }
115
+ end
116
+ ```
117
+
118
+ #### have_datacenter
119
+ ```ruby
120
+ describe consul_service('consul') do
121
+ it { should have_datacenter('dc1') }
122
+ end
123
+ ```
124
+
125
+ #### have_tagged_addresses
126
+ ```ruby
127
+ describe consul_service('consul') do
128
+ it { should have_tagged_addresses({"lan"=>"127.0.0.1", "wan"=>"127.0.0.1"}) }
129
+ end
130
+ ```
131
+
132
+ #### have_node_meta
133
+ ```ruby
134
+ describe consul_service('consul') do
135
+ it { should have_node_meta({"consul-network-segment"=>""}) }
136
+ end
137
+ ```
138
+
139
+ #### have_service_kind
140
+ ```ruby
141
+ describe consul_service('consul') do
142
+ it { should have_service_kind('') }
143
+ end
144
+ ```
145
+
146
+ #### have_service_id
147
+ ```ruby
148
+ describe consul_service('consul') do
149
+ it { should have_service_id('consul') }
150
+ end
151
+ ```
152
+
153
+ #### have_service_name
154
+ ```ruby
155
+ describe consul_service('consul') do
156
+ it { should have_service_name('consul') }
157
+ end
158
+ ```
159
+
160
+ #### have_service_tags
161
+ ```ruby
162
+ describe consul_service('consul') do
163
+ it { should have_service_tags([]) }
164
+ end
165
+ ```
166
+
167
+ #### have_service_address
168
+ ```ruby
169
+ describe consul_service('consul') do
170
+ it { should have_service_address('') }
171
+ end
172
+ ```
173
+
174
+ #### have_service_weights
175
+ ```ruby
176
+ describe consul_service('consul') do
177
+ it { should have_service_weights({"Passing"=>1, "Warning"=>1}) }
178
+ end
179
+ ```
180
+
181
+ #### have_service_meta
182
+ ```ruby
183
+ describe consul_service('consul') do
184
+ it { should have_service_meta({}) }
185
+ end
186
+ ```
187
+
188
+ #### have_service_port
189
+ ```ruby
190
+ describe consul_service('consul') do
191
+ it { should have_service_port(8300) }
192
+ end
193
+ ```
194
+
195
+ #### have_service_enable_tag_override
196
+ ```ruby
197
+ describe consul_service('consul') do
198
+ it { should have_service_enable_tag_override(false) }
199
+ end
200
+ ```
201
+
202
+ #### have_service_proxy_destination
203
+ ```ruby
204
+ describe consul_service('consul') do
205
+ it { should have_service_proxy_destination('') }
206
+ end
207
+ ```
208
+
209
+ #### have_service_proxy
210
+ ```ruby
211
+ describe consul_service('consul') do
212
+ it { should have_service_proxy({}) }
213
+ end
214
+ ```
215
+
216
+ #### have_service_connect
217
+ ```ruby
218
+ describe consul_service('consul') do
219
+ it { should have_service_connect({}) }
220
+ end
221
+ ```
222
+
223
+ #### have_create_index
224
+ ```ruby
225
+ describe consul_service('consul') do
226
+ it { should have_create_index(9) }
227
+ end
228
+ ```
229
+
230
+ #### have_modify_index
231
+ ```ruby
232
+ describe consul_service('consul') do
233
+ it { should have_modify_index(9) }
234
+ end
235
+ ```
236
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
237
+ ### consul_service_list <a name="consul_service_list" ></a>
238
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
239
+ ##### have_service
240
+ ```ruby
241
+ describe consul_service_list() do
242
+ it { should have_service 'consul' }
243
+ end
244
+ ```
245
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
246
+
247
+ ### docker_config <a name="docker_config"></a>
248
+
249
+ ##### exists
250
+ Check if config exists
251
+ ```ruby
252
+ describe docker_config('test.conf') do
253
+ it { should exist }
254
+ end
255
+ ```
256
+
257
+ ##### have_name
258
+ Check if config has a specific name
259
+ ```ruby
260
+ describe docker_config('test.conf') do
261
+ it { should have_name 'test.conf' }
262
+ end
263
+ ```
264
+
265
+ ##### have_data
266
+ Check if config data matches a string
267
+ ```ruby
268
+ describe docker_config('test.conf') do
269
+ it { should have_data 'Some config data' }
270
+ end
271
+ ```
272
+
273
+
274
+ ##### have_data64
275
+ Check if config base64 encoded data matches a string
276
+ ```ruby
277
+ describe docker_config('test.conf') do
278
+ it { should have_data64 'U29tZSBjb25maWcgZGF0YQ=='}
279
+ end
280
+ ```
281
+
282
+
283
+ ##### be_labeled /be_labelled
284
+ Check if config has a specific label
285
+ ```ruby
286
+ describe docker_config('test.conf') do
287
+ it { should have_label('some.label.key') }
288
+ # Check for value
289
+ it { should have_label('some.label.key').with_value('value') }
290
+ end
291
+ ```
292
+
293
+ ### docker_container <a name="docker_container"></a>
31
294
  Extension of the serverspec docker container type, and provides the following matchers:
32
295
 
33
296
  this type now supports selecting the container via a filter or by name
@@ -52,14 +315,14 @@ end
52
315
  ```
53
316
 
54
317
  ##### be_running
55
- Check if a container is runnig (from serverspec)
318
+ Check if a container is running (from serverspec)
56
319
  ```ruby
57
320
  describe docker_container('focused_curie') do
58
321
  it { should be_running }
59
322
  end
60
323
  ```
61
324
  ##### have_image
62
- Check if container is running a spefic image
325
+ Check if container is running a specfic image
63
326
  ```ruby
64
327
  describe docker_container('focused_currie') do
65
328
  it { should have_image('jenkins/jenkins:lts') }
@@ -163,6 +426,160 @@ describe docker_container('focused_currie') do
163
426
  end
164
427
  ```
165
428
 
429
+
430
+
431
+ ### docker_node <a name="docker_node" ></a>
432
+
433
+ ##### exist
434
+ Check if docker node exists
435
+ ```ruby
436
+ describe docker_node('somehost') do
437
+ it { should exist }
438
+ end
439
+ ```
440
+
441
+ ##### be_manager / be_a_manager
442
+ Check if docker node is a manager node
443
+ ```ruby
444
+ describe docker_node(`hostname -f`.chomp) do
445
+ it { should be_a_manager }
446
+ end
447
+ ```
448
+
449
+ ##### be_worker / be_a_worker
450
+ Check if docker node exists
451
+ ```ruby
452
+ describe docker_node('somehost') do
453
+ it { should be_a_worker }
454
+ end
455
+ ```
456
+
457
+ ##### have_engine_version
458
+ Check engine version
459
+ ```ruby
460
+ describe docker_node('somehost') do
461
+ it { should have_engine_version '18.09.1' }
462
+ end
463
+ ```
464
+
465
+ ##### be_active
466
+ Check if node is active
467
+ ```ruby
468
+ describe docker_node('somehost') do
469
+ it { should be_active }
470
+ end
471
+ ```
472
+
473
+ ##### be_draining
474
+ Check if node is draining
475
+
476
+ ```ruby
477
+ describe docker_node('somehost') do
478
+ it { should be_draining }
479
+ end
480
+ ```
481
+
482
+ ##### be_paused
483
+ Check if node is paused
484
+ ```ruby
485
+ describe docker_node('somehost') do
486
+ it { should be_paused }
487
+ end
488
+ ```
489
+
490
+ ### docker_network <a name="docker_network" ></a>
491
+
492
+ ##### exist
493
+ Check if network exists
494
+ ```ruby
495
+ describe docker_network('test_network') do
496
+ it { should exist }
497
+ end
498
+ ```
499
+ ##### be_attachable
500
+ Check if network is attachable
501
+ ```ruby
502
+ describe docker_network('test_network') do
503
+ it { should be_attachable }
504
+ end
505
+ ```
506
+ ##### be_swarm_scoped
507
+ Check if network is swarm scoped
508
+ ```ruby
509
+ describe docker_network('test_network') do
510
+ it { should be_swarm_scoped }
511
+ end
512
+ ```
513
+
514
+ ##### have_driver
515
+ Check if network uses a specific driver
516
+ ```ruby
517
+ describe docker_network('test_network') do
518
+ it { should have_driver('overlay') }
519
+ end
520
+ ```
521
+
522
+ ##### be_overlay
523
+ Check if network is an overlay network
524
+ ```ruby
525
+ describe docker_network('test_network') do
526
+ it { should be_overlay }
527
+ end
528
+ ```
529
+
530
+ ##### be_internal
531
+ Check if network is internal
532
+ ```ruby
533
+ describe docker_network('test_network') do
534
+ it { should_not be_internal }
535
+ end
536
+ ```
537
+
538
+ ##### be_ingress
539
+ Check if network is an ingress network
540
+ ```ruby
541
+ describe docker_network('test_network') do
542
+ it { should_not be_ingress }
543
+ end
544
+ ```
545
+
546
+ ##### be_IPv6_enabled
547
+ Check if network is IPv6 enabled
548
+ ```ruby
549
+ describe docker_network('test_network') do
550
+ it { should_not be_IPv6_enabled }
551
+ end
552
+ ```
553
+
554
+ ### docker_secret <a name="docker_secret"></a>
555
+
556
+ ##### exists
557
+ Check if secret exists
558
+ ```ruby
559
+ describe docker_secret('secret.key') do
560
+ it { should exist }
561
+ end
562
+ ```
563
+
564
+ ##### have_name
565
+ Check if secret has a specific name
566
+ ```ruby
567
+ describe docker_secret('secret.key') do
568
+ it { should have_name 'secret.key' }
569
+ end
570
+ ```
571
+
572
+ ##### be_labeled /be_labelled
573
+ Check if secret has a specific label
574
+ ```ruby
575
+ describe docker_secret('secret.key') do
576
+ it { should have_label('some.label.key') }
577
+ # Check for value
578
+ it { should have_label('some.label.key').with_value('value') }
579
+ end
580
+ ```
581
+
582
+
166
583
  ### docker_service
167
584
  ##### exist
168
585
  Check if a service exists by name
@@ -171,6 +588,242 @@ describe docker_service('my_service') do
171
588
  it { should exist }
172
589
  end
173
590
  ```
591
+ ##### have_image
592
+ Check if service is running a specfic image
593
+ ```ruby
594
+ describe docker_service('my-awesome-service') do
595
+ it { should have_image('jenkins/jenkins:lts') }
596
+ end
597
+ ```
598
+
599
+ ##### have_user / run_as_user
600
+ Check if service is running as the specified user
601
+ ```ruby
602
+ describe docker_service('my-awesome-service') do
603
+ it { should run_as_user('jenkins') }
604
+ end
605
+ ```
606
+
607
+ ##### map_port
608
+ Check if host port is mapped to service port
609
+ ```ruby
610
+ describe docker_service('my-awesome-service') do
611
+ it { should map_port('80','8080') }
612
+ end
613
+ ```
614
+ Check if host port is mapped to service port using a specific protocol
615
+ ```ruby
616
+ describe docker_service('my-awesome-service') do
617
+ it { should map_port('80','8080').using_protocol('tcp') }
618
+ end
619
+ ```
620
+ ##### have_volume
621
+ Check the for a volume (from serverspec)
622
+ ```ruby
623
+ describe docker_service('my-awesome-service') do
624
+ it { it { should have_volume('/tmp','/data') }}
625
+ end
626
+ ```
627
+ ##### have_mount
628
+ Check the for mounted volume
629
+ ```ruby
630
+ describe docker_service('my-awesome-service') do
631
+ it { should have_mount('/var/run/docker.sock', '/var/run/docker.sock') }
632
+ end
633
+ ```
634
+ ##### have_restart_policy
635
+ Check the services restart policy
636
+ ```ruby
637
+ describe docker_service('my-awesome-service') do
638
+ it { should have_restart_policy('any') }
639
+ end
640
+ ```
641
+ ##### have_restart_limit
642
+ Check the services restart limit
643
+ ```ruby
644
+ describe docker_service('my-awesome-service') do
645
+ it { should have_restart_limit(1) }
646
+ end
647
+ ```
648
+ ##### have_host
649
+ Check for additional /etc/hosts entries
650
+ ```ruby
651
+ describe docker_service('my-awesome-service') do
652
+ it { should have_host('8.8.8.8 dns') }
653
+ end
654
+ ```
655
+ ##### have_environment_variable
656
+ Check if the service has an specific environment variable
657
+ ```ruby
658
+ describe docker_service('my-awesome-service') do
659
+ it { should have_environment_variable('CONSUL_VERSION') }
660
+ end
661
+ # check its value
662
+ describe docker_service('my-awesome-service') do
663
+ it { should have_environment_variable('CONSUL_VERSION').with_value('1.2.0') }
664
+ end
665
+ ```
666
+
667
+ ##### be_labeled/be_labelled
668
+ Check if the service has an specific label
669
+ ```ruby
670
+ describe docker_service('my-awesome-service') do
671
+ it { should be_labeled('CONSUL_VERSION') }
672
+ end
673
+ # check its value
674
+ describe docker_service('my-awesome-service') do
675
+ it { should be_labeled('CONSUL_VERSION').with_value('1.2.0') }
676
+ end
677
+ ```
678
+ This matcher supports both the UK and US spelling of labelled and also has have_label as an alias but this may conflict with dockerspec's have_lable matcher if using along side
679
+ ##### have_config
680
+ Check the service has a particular config
681
+ ```ruby
682
+ describe docker_service('my-awesome-service') do
683
+ # Check that it uses a config
684
+ it { should have_config('nginx.conf') }
685
+ # Check that it places the config in a particular location
686
+ it { should have_config('nginx.conf', '/some/target/path') }
687
+ end
688
+ ```
689
+ ##### have_secret
690
+ Check the service has a particular secret
691
+ ```ruby
692
+ describe docker_service('my-awesome-service') do
693
+ # Check that it uses a secret
694
+ it { should have_secret('secret.crt') }
695
+ # Check that it places the secret in a particular location
696
+ it { should have_secret('secret.crt', '/some/target/path') }
697
+ end
698
+ ```
699
+
700
+ ##### be_global
701
+ Check the service is running in global mode
702
+ ```ruby
703
+ describe docker_service('my-awesome-service') do
704
+ it { should be_global }
705
+ end
706
+ ```
707
+ ##### be_replicated
708
+ Check the service is running in replicated mode
709
+ ```ruby
710
+ describe docker_service('my-awesome-service') do
711
+ it { should be_replicated }
712
+ end
713
+ ```
714
+ ##### have_replica_count
715
+ Check the number of replicas the service has
716
+ ```ruby
717
+ describe docker_service('my-awesome-service') do
718
+ it { should have_replica_count 2 }
719
+ end
720
+ ```
721
+
722
+ ##### have_placement_constraint
723
+ Check the number of replicas the service has
724
+ ```ruby
725
+ describe docker_service('my-awesome-service') do
726
+ it { should have_placement_constraint('node.role == manager') }
727
+ end
728
+ ```
729
+
730
+
731
+ ### jenkins_credential <a name="jenkins_credential" ></a>
732
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
733
+
734
+ _TODO_
735
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
736
+ ### jenkins_job <a name="jenkins_job" ></a>
737
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
738
+
739
+ _TODO_
740
+
741
+ ### jenkins_plugin <a name="jenkins_plugin" ></a>
742
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
743
+
744
+ _TODO_
745
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
746
+ ### nfs_export <a name="nfs_export" ></a>
747
+
748
+ _TODO_
749
+
750
+ ### rabbitmq_node_list <a name="rabbitmq_node_list" ></a>
751
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
752
+
753
+ _TODO_
754
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
755
+ ### rabbitmq_user_permission <a name="rabbitmq_user_permission" ></a>
756
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
757
+
758
+ _TODO_
759
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
760
+
761
+ ### rabbitmq_vhost_list <a name="rabbitmq_vhost_list" ></a>
762
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
763
+
764
+ _TODO_
765
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
766
+
767
+ ### rabbitmq_vhost_policy <a name="rabbitmq_node_policy" ></a>
768
+ <sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
769
+
770
+ _TODO_
771
+ <sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
772
+
773
+ ### sudo_user <a name="sudo_user" ></a>
774
+ Check the sudo permissions of a given user
775
+
776
+ ##### exist
777
+ Checks if the user exists and is in the sudoers file
778
+ ```ruby
779
+ describe sudo_user('someuser') do
780
+ it { should exist }
781
+ end
782
+ ```
783
+
784
+ ##### have_sudo_disabled
785
+ Ensures the user has no sudo permssions
786
+ ```ruby
787
+ describe sudo_user('someuser') do
788
+ it { should have_sudo_disabled }
789
+ end
790
+ ```
791
+
792
+ ##### be_allowed_to_run_command
793
+ Ensures the user can run a command
794
+ ```ruby
795
+ describe sudo_user('someuser') do
796
+ it { should be_allowed_run_anything }
797
+ # Without password
798
+ it { should be_allowed_run_anything.without_a_password }
799
+ #As a particular user
800
+ it { should be_allowed_run_anything.as('someotheruser') }
801
+ #As a particular user with out a password
802
+ it { should be_allowed_run_anything.as('someotheruser').without_a_password }
803
+ #As any user
804
+ it { should be_allowed_run_anything.as_anybody }
805
+ #As Any user without a password
806
+ it { should be_allowed_run_anything.as_anybody.without_password }
807
+ end
808
+ ```
809
+ ##### be_allowed_to_run_anything
810
+ Ensures the user can run a anything
811
+ ```ruby
812
+ describe sudo_user('someuser') do
813
+ it { should be_allowed_run_anything }
814
+ # Without password
815
+ it { should be_allowed_run_anything.without_a_password }
816
+ #As a particular user
817
+ it { should be_allowed_run_anything.as('someotheruser') }
818
+ #As a particular user with out a password
819
+ it { should be_allowed_run_anything.as('someotheruser').without_a_password }
820
+ #As any user
821
+ it { should be_allowed_run_anything.as_anybody }
822
+ #As Any user without a password
823
+ it { should be_allowed_run_anything.as_anybody.without_password }
824
+ end
825
+ ```
826
+
174
827
 
175
828
  ## Development
176
829