serverspec-extra-types 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +117 -0
- data/.rubocop.yml +24 -2
- data/.simplecov +7 -0
- data/README.md +344 -15
- data/lib/serverspec-extra-types.rb +5 -0
- data/lib/serverspec_extra_types.rb +4 -3
- data/lib/serverspec_extra_types/matchers.rb +2 -1
- data/lib/serverspec_extra_types/matchers/allowed_to_run_anything.rb +12 -9
- data/lib/serverspec_extra_types/matchers/allowed_to_run_command.rb +8 -6
- data/lib/serverspec_extra_types/matchers/apply_to.rb +7 -0
- data/lib/serverspec_extra_types/matchers/have_host.rb +8 -1
- data/lib/serverspec_extra_types/matchers/have_image.rb +1 -0
- data/lib/serverspec_extra_types/matchers/have_label.rb +1 -3
- data/lib/serverspec_extra_types/types/api_base.rb +3 -2
- data/lib/serverspec_extra_types/types/consul_base.rb +5 -1
- data/lib/serverspec_extra_types/types/consul_node_list.rb +1 -1
- data/lib/serverspec_extra_types/types/consul_service.rb +2 -4
- data/lib/serverspec_extra_types/types/curl.rb +2 -0
- data/lib/serverspec_extra_types/types/docker_config.rb +4 -1
- data/lib/serverspec_extra_types/types/docker_container.rb +2 -0
- data/lib/serverspec_extra_types/types/docker_network.rb +6 -4
- data/lib/serverspec_extra_types/types/docker_node.rb +3 -1
- data/lib/serverspec_extra_types/types/docker_secret.rb +4 -2
- data/lib/serverspec_extra_types/types/docker_service.rb +3 -1
- data/lib/serverspec_extra_types/types/jenkins_base.rb +0 -1
- data/lib/serverspec_extra_types/types/jenkins_credential.rb +5 -6
- data/lib/serverspec_extra_types/types/jenkins_job.rb +7 -6
- data/lib/serverspec_extra_types/types/jenkins_plugin.rb +8 -4
- data/lib/serverspec_extra_types/types/nfs_export.rb +16 -4
- data/lib/serverspec_extra_types/types/rabbitmq_base.rb +2 -2
- data/lib/serverspec_extra_types/types/rabbitmq_node_list.rb +1 -1
- data/lib/serverspec_extra_types/types/rabbitmq_vhost_list.rb +1 -1
- data/lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb +13 -1
- data/lib/serverspec_extra_types/types/sudo_user.rb +18 -15
- data/lib/serverspec_extra_types/version.rb +1 -1
- data/properties.yml +31 -5
- data/serverspec-extra-types.gemspec +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07e0b377e97ee5774ad9b82d7d8361ee97710baaf6832aa989e413b878abec88
|
4
|
+
data.tar.gz: 67f044bf10e1d6963e222617ec85710f33ed2b1fa39deda8c05993e609021bcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c724cf04b0656794930841f27fe0dd4e878287a14e7df46cb8d29c2b373eb7f28e6736a36dae2596031abfe43c3861a8451791ea32bd480990c7dcc3c1b3406
|
7
|
+
data.tar.gz: ae1e4e5d0f76c6707d71a83f16976941faa721ed1a9185cff96eedf3ddccf94bb002c037ab69a76aaf59f9f5ed1df27839c5b76ffeed80bc0a3ac42ef4771857
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
variables:
|
2
|
+
DOCKER_HOST: tcp://docker:2375
|
3
|
+
DOCKER_DRIVER: overlay2
|
4
|
+
services:
|
5
|
+
- name: docker:stable-dind
|
6
|
+
alias: localhost
|
7
|
+
|
8
|
+
before_script:
|
9
|
+
- >
|
10
|
+
apk --update add --virtual build-dependencies build-base ruby ruby-rdoc ruby-dev ruby-irb postgresql-dev ruby-etc
|
11
|
+
libc-dev zlib-dev linux-headers git ruby-bigdecimal ruby-io-console libstdc++ tzdata postgresql-client
|
12
|
+
nodejs libffi-dev curl wget py-pip ruby-webrick ruby-etc
|
13
|
+
- gem install bundle
|
14
|
+
- bundle install
|
15
|
+
|
16
|
+
docker_sevice: &container_config
|
17
|
+
image: docker:stable
|
18
|
+
variables: &task_variables
|
19
|
+
DOCKER_DRIVER: overlay2
|
20
|
+
SERVERSPEC_TARGET: service
|
21
|
+
RAKE_TARGET: serverspec:${SERVERSPEC_TARGET}
|
22
|
+
script:
|
23
|
+
- bundle exec rake ${RAKE_TARGET}
|
24
|
+
|
25
|
+
docker_container:
|
26
|
+
<<: *container_config
|
27
|
+
variables:
|
28
|
+
<<: *task_variables
|
29
|
+
SERVERSPEC_TARGET: container
|
30
|
+
|
31
|
+
docker_network:
|
32
|
+
<<: *container_config
|
33
|
+
variables:
|
34
|
+
<<: *task_variables
|
35
|
+
SERVERSPEC_TARGET: network
|
36
|
+
|
37
|
+
docker_secret:
|
38
|
+
<<: *container_config
|
39
|
+
variables:
|
40
|
+
<<: *task_variables
|
41
|
+
SERVERSPEC_TARGET: secret
|
42
|
+
|
43
|
+
docker_config:
|
44
|
+
<<: *container_config
|
45
|
+
variables:
|
46
|
+
<<: *task_variables
|
47
|
+
SERVERSPEC_TARGET: config
|
48
|
+
|
49
|
+
docker_node:
|
50
|
+
<<: *container_config
|
51
|
+
variables:
|
52
|
+
<<: *task_variables
|
53
|
+
SERVERSPEC_TARGET: node
|
54
|
+
|
55
|
+
curl:
|
56
|
+
<<: *container_config
|
57
|
+
variables:
|
58
|
+
<<: *task_variables
|
59
|
+
SERVERSPEC_TARGET: curl
|
60
|
+
|
61
|
+
consul:
|
62
|
+
<<: *container_config
|
63
|
+
variables:
|
64
|
+
<<: *task_variables
|
65
|
+
SERVERSPEC_TARGET: consul
|
66
|
+
|
67
|
+
rabbitmq:
|
68
|
+
<<: *container_config
|
69
|
+
variables:
|
70
|
+
<<: *task_variables
|
71
|
+
SERVERSPEC_TARGET: rabbitmq
|
72
|
+
|
73
|
+
nfs_export:
|
74
|
+
<<: *container_config
|
75
|
+
variables:
|
76
|
+
<<: *task_variables
|
77
|
+
SERVERSPEC_TARGET: nfs_export
|
78
|
+
|
79
|
+
sudo:
|
80
|
+
<<: *container_config
|
81
|
+
variables:
|
82
|
+
<<: *task_variables
|
83
|
+
SERVERSPEC_TARGET: sudo
|
84
|
+
|
85
|
+
sudo_user:
|
86
|
+
<<: *container_config
|
87
|
+
variables:
|
88
|
+
<<: *task_variables
|
89
|
+
SERVERSPEC_TARGET: sudo_user
|
90
|
+
|
91
|
+
jenkins_plugin:
|
92
|
+
<<: *container_config
|
93
|
+
variables:
|
94
|
+
<<: *task_variables
|
95
|
+
SERVERSPEC_TARGET: jenkins_plugin
|
96
|
+
services:
|
97
|
+
- name: docker:stable-dind
|
98
|
+
alias: localhost
|
99
|
+
|
100
|
+
jenkins_credential:
|
101
|
+
<<: *container_config
|
102
|
+
variables:
|
103
|
+
<<: *task_variables
|
104
|
+
SERVERSPEC_TARGET: jenkins_credential
|
105
|
+
services:
|
106
|
+
- name: docker:stable-dind
|
107
|
+
alias: localhost
|
108
|
+
|
109
|
+
|
110
|
+
jenkins_jobs:
|
111
|
+
<<: *container_config
|
112
|
+
variables:
|
113
|
+
<<: *task_variables
|
114
|
+
SERVERSPEC_TARGET: jenkins_job
|
115
|
+
services:
|
116
|
+
- name: docker:stable-dind
|
117
|
+
alias: localhost
|
data/.rubocop.yml
CHANGED
@@ -1,14 +1,20 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
#inherit_from: .rubocop_todo.yml
|
4
|
+
|
1
5
|
AllCops:
|
2
6
|
TargetRubyVersion: 2.4
|
3
7
|
Exclude:
|
4
8
|
- 'serverspec-extra-types.gemspec'
|
5
9
|
- 'util/mkcode.rb'
|
10
|
+
- 'bin/*'
|
11
|
+
- 'spec/helpers/hash_helper.rb'
|
6
12
|
|
7
13
|
Style/Documentation:
|
8
14
|
Enabled: false
|
9
15
|
|
10
16
|
Metrics/LineLength:
|
11
|
-
Max:
|
17
|
+
Max: 160
|
12
18
|
|
13
19
|
|
14
20
|
Metrics/MethodLength:
|
@@ -18,4 +24,20 @@ Metrics/BlockLength:
|
|
18
24
|
Exclude:
|
19
25
|
- 'Rakefile'
|
20
26
|
- '**/*.rake'
|
21
|
-
- 'spec/**/*.rb'
|
27
|
+
- 'spec/**/*.rb'
|
28
|
+
|
29
|
+
Naming/PredicateName:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/**/types/*.rb'
|
32
|
+
|
33
|
+
#Naming/AccessorMethodName:
|
34
|
+
|
35
|
+
Style/ClassAndModuleChildren:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/**/types/*.rb'
|
38
|
+
- 'spec/sudo_user_spec.rb'
|
39
|
+
|
40
|
+
Style/FormatStringToken:
|
41
|
+
Exclude:
|
42
|
+
- 'lib/serverspec_extra_types/types/curl.rb'
|
43
|
+
|
data/.simplecov
ADDED
data/README.md
CHANGED
@@ -43,7 +43,7 @@ require 'serverspec-extra-types'
|
|
43
43
|
[rabbitmq_node_list](#rabbitmq_node_list) | [rabbitmq_user_permission](#rabbitmq_user_permission) |
|
44
44
|
[rabbitmq_vhost_list](#rabbitmq_vhost_list) | [rabbitmq_vhost_policy](#rabbitmq_vhost_policy) | [sudo_user](#sudo_user)
|
45
45
|
|
46
|
-
### curl <a name="curl" ></a>
|
46
|
+
### curl(url, options = {}) <a name="curl" ></a>
|
47
47
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
48
48
|
|
49
49
|
The curl resource allow for check against remote url. Addition parameters are avaliable to allow for insecure certifactes and follow redirects
|
@@ -579,7 +579,6 @@ Check if secret has a specific label
|
|
579
579
|
end
|
580
580
|
```
|
581
581
|
|
582
|
-
|
583
582
|
### docker_service
|
584
583
|
##### exist
|
585
584
|
Check if a service exists by name
|
@@ -728,46 +727,376 @@ end
|
|
728
727
|
```
|
729
728
|
|
730
729
|
|
731
|
-
### jenkins_credential <a name="jenkins_credential" ></a>
|
730
|
+
### jenkins_credential(credential_id) <a name="jenkins_credential" ></a>
|
732
731
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
732
|
+
#### exists
|
733
|
+
Verifies that the credential exists
|
734
|
+
```ruby
|
735
|
+
describe jenkins_credential('someCredential') do
|
736
|
+
it { should exist }
|
737
|
+
end
|
738
|
+
```
|
739
|
+
#### have_description(description)
|
740
|
+
Checks if the credential description matches the specified text
|
741
|
+
```ruby
|
742
|
+
describe jenkins_credential('someCredential') do
|
743
|
+
it { should have_description 'Username and Password Credential' }
|
744
|
+
end
|
745
|
+
```
|
746
|
+
#### have_display_name(text)
|
747
|
+
Checks if the display name matches the specified text
|
748
|
+
```ruby
|
749
|
+
describe jenkins_credential('someCredential') do
|
750
|
+
it { should have_display_name 'test/****** (Username and Password Credential)'}
|
751
|
+
end
|
752
|
+
```
|
753
|
+
#### be_username_with_password
|
754
|
+
Checks if credential is a username and password
|
755
|
+
```ruby
|
756
|
+
describe jenkins_credential('someCredential') do
|
757
|
+
it { should be_username_with_password }
|
758
|
+
end
|
759
|
+
```
|
760
|
+
|
761
|
+
#### be_secret_text
|
762
|
+
Checks if credential is a secret string
|
763
|
+
```ruby
|
764
|
+
describe jenkins_credential('someCredential') do
|
765
|
+
it { should be_secret_text }
|
766
|
+
end
|
767
|
+
```
|
768
|
+
#### be_ssh_private_key
|
769
|
+
Checks if credential is an ssh private key
|
770
|
+
```ruby
|
771
|
+
describe jenkins_credential('someCredential') do
|
772
|
+
it { should be_ssh_private_key }
|
773
|
+
end
|
774
|
+
```
|
775
|
+
|
776
|
+
#### be_aws_credential
|
777
|
+
Checks if credential is an aws access key/ secret tken pair
|
778
|
+
```ruby
|
779
|
+
describe jenkins_credential('someCredential') do
|
780
|
+
it { should be_aws_credential }
|
781
|
+
end
|
782
|
+
```
|
783
|
+
|
784
|
+
#### be_gitlab_api_token
|
785
|
+
Checks if credential is a gitlab api token
|
786
|
+
```ruby
|
787
|
+
describe jenkins_credential('someCredential') do
|
788
|
+
it { should be_gitlab_api_token }
|
789
|
+
end
|
790
|
+
```
|
791
|
+
|
733
792
|
|
734
|
-
_TODO_
|
735
793
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
736
|
-
### jenkins_job <a name="jenkins_job" ></a>
|
794
|
+
### jenkins_job(jobname) <a name="jenkins_job" ></a>
|
737
795
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
738
796
|
|
739
|
-
|
797
|
+
#### exists
|
798
|
+
Verifies that the job exists
|
799
|
+
```ruby
|
800
|
+
describe jenkins_job('someJob') do
|
801
|
+
it { should exist }
|
802
|
+
end
|
803
|
+
```
|
804
|
+
|
805
|
+
#### have_name(name)
|
806
|
+
Verifies that the job has the specified name
|
807
|
+
```ruby
|
808
|
+
describe jenkins_job('someJob') do
|
809
|
+
it { should have_name 'someJob' }
|
810
|
+
end
|
811
|
+
```
|
812
|
+
|
813
|
+
#### have_display_name(displayName)
|
814
|
+
Verifies that the job has the specified display name
|
815
|
+
```ruby
|
816
|
+
describe jenkins_job('someJob') do
|
817
|
+
it { should have_display_name 'Some Job' }
|
818
|
+
end
|
819
|
+
```
|
820
|
+
|
821
|
+
#### have_full_display_name(displayName)
|
822
|
+
Verifies that the job has the specified full display name
|
823
|
+
```ruby
|
824
|
+
describe jenkins_job('someJob') do
|
825
|
+
it { should have_full_display_name 'someJob' }
|
826
|
+
end
|
827
|
+
#Jobs in folders use a '»' symbol inbetween the foldername and job name
|
828
|
+
describe jenkins_job('someFolder/someJob') do
|
829
|
+
it { should have_full_display_name 'someFolder » someJob' }
|
830
|
+
end
|
831
|
+
```
|
832
|
+
|
833
|
+
#### have_description(description)
|
834
|
+
Verifies that the job has the specified display name
|
835
|
+
```ruby
|
836
|
+
describe jenkins_job('someJob') do
|
837
|
+
it { should have_description 'Some Job' }
|
838
|
+
end
|
839
|
+
```
|
840
|
+
|
841
|
+
#### be_freestyle / be_freestyle_project
|
842
|
+
Verifies that the job is a free style project
|
843
|
+
```ruby
|
844
|
+
describe jenkins_job('freestyle') do
|
845
|
+
it { should be_freestyle }
|
846
|
+
it { should be_freestyle_project }
|
847
|
+
end
|
848
|
+
```
|
849
|
+
|
850
|
+
#### be_maven / be_maven_project
|
851
|
+
Verifies that the job is a maven project
|
852
|
+
```ruby
|
853
|
+
describe jenkins_job('maven') do
|
854
|
+
it { should be_maven }
|
855
|
+
it { should be_maven_project }
|
856
|
+
end
|
857
|
+
```
|
858
|
+
|
859
|
+
#### be_pipeline / be_pipeline_project
|
860
|
+
Verifies that the job is a pipeline project
|
861
|
+
```ruby
|
862
|
+
describe jenkins_job('pipeleine') do
|
863
|
+
it { should be_pipeline }
|
864
|
+
it { should be_pipeline_project }
|
865
|
+
end
|
866
|
+
```
|
867
|
+
|
868
|
+
#### be_multibranch / be_multibranch_project
|
869
|
+
Verifies that the job is a multibranch project
|
870
|
+
```ruby
|
871
|
+
describe jenkins_job('multibranch') do
|
872
|
+
it { should be_multibranch }
|
873
|
+
it { should be_multibranch_project }
|
874
|
+
end
|
875
|
+
```
|
876
|
+
|
877
|
+
#### be_folder / be_directory
|
878
|
+
Verifies that the job is a folder
|
879
|
+
```ruby
|
880
|
+
describe jenkins_job('folder') do
|
881
|
+
it { should be_multibranch }
|
882
|
+
it { should be_multibranch_project }
|
883
|
+
end
|
884
|
+
```
|
885
|
+
|
886
|
+
#### have_job_type(type) / have_project_type(type)
|
887
|
+
Checks if the job has a particular type
|
888
|
+
```ruby
|
889
|
+
describe jenkins_job('pipeline') do
|
890
|
+
it { should have_job_type('org.jenkinsci.plugins.workflow.job.WorkflowJob') }
|
891
|
+
it { should have_project_type('org.jenkinsci.plugins.workflow.job.WorkflowJob') }
|
892
|
+
end
|
893
|
+
```
|
894
|
+
|
895
|
+
#### have_job(job)
|
896
|
+
Checks if the folder conatins the specified job
|
897
|
+
```ruby
|
898
|
+
describe jenkins_job('folder') do
|
899
|
+
it { should have_job 'job' }
|
900
|
+
|
901
|
+
end
|
902
|
+
```
|
903
|
+
|
904
|
+
#### have_job_count(count)
|
905
|
+
Checks if the folder conatins the specified number of jobs
|
906
|
+
```ruby
|
907
|
+
describe jenkins_job('folder') do
|
908
|
+
it { should have_job_count 1 }
|
909
|
+
end
|
910
|
+
```
|
911
|
+
|
912
|
+
#### have_empty_job_list
|
913
|
+
Checks if the folder conatains no jobs
|
914
|
+
```ruby
|
915
|
+
describe jenkins_job('folder') do
|
916
|
+
it { should have_empty_job_list }
|
917
|
+
end
|
918
|
+
```
|
919
|
+
|
920
|
+
##### Jobs inside folders
|
921
|
+
Jobs inside folder can be acessed vi folderName/jobName (ie the job urls without any '/jobs') for example
|
922
|
+
```ruby
|
923
|
+
describe jenkins_job('folder/job') do
|
924
|
+
it { should exist }
|
925
|
+
end
|
926
|
+
```
|
927
|
+
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
928
|
+
|
740
929
|
|
741
930
|
### jenkins_plugin <a name="jenkins_plugin" ></a>
|
742
931
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
932
|
+
#### exists
|
933
|
+
Checks if the plugin exists and is installed
|
934
|
+
```ruby
|
935
|
+
describe jenkins_plugin('ssh-slaves') do
|
936
|
+
it { should exist }
|
937
|
+
end
|
938
|
+
```
|
939
|
+
#### has_version
|
940
|
+
Check is plugin has a particular version
|
941
|
+
```ruby
|
942
|
+
describe jenkins_plugin('ssh-slaves') do
|
943
|
+
it { should have_version '1.29.4' }
|
944
|
+
end
|
945
|
+
```
|
946
|
+
#### be_installed
|
947
|
+
Also supports be_installed from serverspec (by matcher chain not supported)
|
948
|
+
```ruby
|
949
|
+
describe jenkins_plugin('ssh-slaves') do
|
950
|
+
it { should be_installed }
|
951
|
+
# Supports with_version
|
952
|
+
it { should be_installed.with_version '1.29.4' }
|
953
|
+
end
|
954
|
+
```
|
743
955
|
|
744
|
-
_TODO_
|
745
956
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
746
|
-
### nfs_export <a name="nfs_export" ></a>
|
957
|
+
### nfs_export(export) <a name="nfs_export" ></a>
|
958
|
+
#### exist
|
959
|
+
Verifies that the specified export exists
|
960
|
+
```ruby
|
961
|
+
describe nfs_export('/var/nfsroot') do
|
962
|
+
it { should exist }
|
963
|
+
it { should have_host('192.168.1.0/16') }
|
964
|
+
it { should have_host('192.168.1.0/16').with_option('root_squash') }
|
965
|
+
it { should have_host('192.168.1.0/16').with_options('rw,root_squash') }
|
966
|
+
it { should have_host('192.168.1.0/16').with_options(%q[rw root_squash subtree_check]) }
|
967
|
+
end
|
968
|
+
```
|
969
|
+
#### have_host
|
970
|
+
Verifies that the specified export has permission for the specified host/cidr range
|
971
|
+
|
972
|
+
Supports a with_option matcher to verify if the export has a specifed export option
|
973
|
+
Supports a with_options matcher to verify options in list format
|
974
|
+
```ruby
|
975
|
+
describe nfs_export('/var/nfsroot') do
|
976
|
+
it { should have_host('192.168.1.0/16') }
|
977
|
+
# Check for a specified option
|
978
|
+
it { should have_host('192.168.1.0/16').with_option('root_squash') }
|
979
|
+
# Check for a list of options as a comma delimited string (order is not important)
|
980
|
+
it { should have_host('192.168.1.0/16').with_options('rw,root_squash') }
|
981
|
+
# Check for a list of options as an array
|
982
|
+
it { should have_host('192.168.1.0/16').with_options(%q[rw root_squash subtree_check]) }
|
983
|
+
end
|
984
|
+
```
|
747
985
|
|
748
|
-
_TODO_
|
749
986
|
|
750
987
|
### rabbitmq_node_list <a name="rabbitmq_node_list" ></a>
|
751
988
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
752
|
-
|
753
|
-
|
989
|
+
#### have_count
|
990
|
+
Verifies the number of nodes in the node list
|
991
|
+
```ruby
|
992
|
+
describe rabbitmq_node_list do
|
993
|
+
it { should have_count(1) }
|
994
|
+
end
|
995
|
+
```
|
754
996
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
755
997
|
### rabbitmq_user_permission <a name="rabbitmq_user_permission" ></a>
|
756
998
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
999
|
+
#### read_from_queue(vhost, queue)
|
1000
|
+
Verifies that the user can read from the specifed queue on the specified vhost
|
1001
|
+
```ruby
|
1002
|
+
describe rabbitmq_user_permission('MyUser') do
|
1003
|
+
it { should read_from_queue('MyVhost', 'Q1') }
|
1004
|
+
end
|
1005
|
+
```
|
1006
|
+
|
1007
|
+
#### write_to_queue(vhost, queue)
|
1008
|
+
Verifies that the user can read from the specifed queue on the specified vhost
|
1009
|
+
```ruby
|
1010
|
+
describe rabbitmq_user_permission('MyUser') do
|
1011
|
+
it { should write_to_queue('MyVhost', 'Q1') }
|
1012
|
+
end
|
1013
|
+
```
|
1014
|
+
|
1015
|
+
#### configure_queue(vhost, queue)
|
1016
|
+
Verifies that the user can configure the specified queue on the specified vhost
|
1017
|
+
```ruby
|
1018
|
+
describe rabbitmq_user_permission('MyUser') do
|
1019
|
+
it { should configure_queue('MyVhost', 'Q1') }
|
1020
|
+
end
|
1021
|
+
```
|
757
1022
|
|
758
|
-
_TODO_
|
759
1023
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
760
1024
|
|
761
1025
|
### rabbitmq_vhost_list <a name="rabbitmq_vhost_list" ></a>
|
762
1026
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
763
1027
|
|
764
|
-
|
1028
|
+
#### have_vhost(vhost)
|
1029
|
+
Verifies that the vhost_list contains the specified vhost
|
1030
|
+
```ruby
|
1031
|
+
describe rabbitmq_vhost_list do
|
1032
|
+
it { should have_vhost('MyVhost') }
|
1033
|
+
end
|
1034
|
+
```
|
765
1035
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
766
1036
|
|
767
|
-
### rabbitmq_vhost_policy <a name="
|
1037
|
+
### rabbitmq_vhost_policy(policy, vhost) <a name="rabbitmq_vhost_policy" ></a>
|
768
1038
|
<sub><sup>Please note: This type requires curl to be installed on the target host</sup></sub>
|
1039
|
+
#### exists
|
1040
|
+
Verifies that the specified policy exists on a given vhost
|
1041
|
+
```ruby
|
1042
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1043
|
+
it { should exist }
|
1044
|
+
end
|
1045
|
+
```
|
1046
|
+
|
1047
|
+
#### have_ha_mode(mode)
|
1048
|
+
Verifies the high availability mode
|
1049
|
+
```ruby
|
1050
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1051
|
+
it { should have_ha_mode 'exactly' }
|
1052
|
+
end
|
1053
|
+
```
|
1054
|
+
#### have_ha_nodes(count)
|
1055
|
+
Verifies the number of high availability nodes
|
1056
|
+
```ruby
|
1057
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1058
|
+
it { should have_ha_nodes 2 }
|
1059
|
+
end
|
1060
|
+
```
|
1061
|
+
#### have_ha_sync_mode(mode)
|
1062
|
+
Verifies the high availability syncronisation mode
|
1063
|
+
```ruby
|
1064
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1065
|
+
it { should have_ha_sync_mode 'automatic' }
|
1066
|
+
end
|
1067
|
+
```
|
1068
|
+
#### apply_to(type)
|
1069
|
+
Verifies that the policy is applies to *type*
|
1070
|
+
```ruby
|
1071
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1072
|
+
it { should apply_to }
|
1073
|
+
end
|
1074
|
+
```
|
1075
|
+
|
1076
|
+
#### mirror_exchanges
|
1077
|
+
Verifies the policy applies to onlyexchanges
|
1078
|
+
```ruby
|
1079
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1080
|
+
it { should mirror_exchanges }
|
1081
|
+
end
|
1082
|
+
```
|
1083
|
+
|
1084
|
+
#### mirror_queues
|
1085
|
+
Verifies the policy applies to both queues and exchanges
|
1086
|
+
```ruby
|
1087
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1088
|
+
it { should mirror_queues }
|
1089
|
+
end
|
1090
|
+
```
|
1091
|
+
|
1092
|
+
#### mirror_all
|
1093
|
+
Verifies the policy applies to both queues and exchanges
|
1094
|
+
```ruby
|
1095
|
+
describe rabbitmq_vhost_policy('ha-all', 'MyVhost') do
|
1096
|
+
it { should mirror_all }
|
1097
|
+
end
|
1098
|
+
```
|
769
1099
|
|
770
|
-
_TODO_
|
771
1100
|
<sub><sup>Supports the same additional parameters as the curl matcher</sup></sub>
|
772
1101
|
|
773
1102
|
### sudo_user <a name="sudo_user" ></a>
|