mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Refactors docker_service docs (#2519)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
This commit is contained in:
parent
73f2eebea5
commit
903ab396f0
1 changed files with 54 additions and 48 deletions
|
@ -19,6 +19,10 @@ A `docker_service` resource block declares the service by name:
|
|||
its('tag') { should eq 'latest' }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Resource Parameter Examples
|
||||
|
||||
The resource allows you to pass in a service id:
|
||||
|
||||
describe docker_service(id: '2ghswegspre1') do
|
||||
|
@ -33,9 +37,57 @@ You can also pass in the fully-qualified image:
|
|||
|
||||
<br>
|
||||
|
||||
## Examples
|
||||
## Property Examples
|
||||
|
||||
The following examples show how to use this InSpec `docker_service` resource.
|
||||
The following examples show how to use InSpec `docker_service` resource.
|
||||
|
||||
### id
|
||||
|
||||
The `id` property returns the service id:
|
||||
|
||||
its('id') { should eq '2ghswegspre1' }
|
||||
|
||||
### image
|
||||
|
||||
The `image` property tests the value of the image. It is a combination of `repository:tag`:
|
||||
|
||||
its('image') { should eq 'alpine:latest' }
|
||||
|
||||
### mode
|
||||
|
||||
The `mode` property tests the value of the service mode:
|
||||
|
||||
its('mode') { should eq 'replicated' }
|
||||
|
||||
### name
|
||||
|
||||
The `name` property tests the value of the service name:
|
||||
|
||||
its('name') { should eq 'foo' }
|
||||
|
||||
### ports
|
||||
|
||||
The `ports` property tests the value of the service's published ports:
|
||||
|
||||
its('ports') { should include '*:8000->8000/tcp' }
|
||||
|
||||
### repo
|
||||
|
||||
The `repo` property tests the value of the repository name:
|
||||
|
||||
its('repo') { should eq 'alpine' }
|
||||
|
||||
### replicas
|
||||
|
||||
The `replicas` property tests the value of the service's replica count:
|
||||
|
||||
its('replicas') { should eq '3/3' }
|
||||
|
||||
### tag
|
||||
|
||||
The `tag` property tests the value of image tag:
|
||||
|
||||
its('tag') { should eq 'latest' }
|
||||
|
||||
### Test a docker service
|
||||
|
||||
|
@ -58,50 +110,4 @@ The `exist` matcher tests if the image is available on the node:
|
|||
|
||||
it { should exist }
|
||||
|
||||
### id
|
||||
|
||||
The `id` matcher returns the service id:
|
||||
|
||||
its('id') { should eq '2ghswegspre1' }
|
||||
|
||||
### image
|
||||
|
||||
The `image` matcher tests the value of the image. It is a combination of `repository:tag`:
|
||||
|
||||
its('image') { should eq 'alpine:latest' }
|
||||
|
||||
### mode
|
||||
|
||||
The `mode` matcher tests the value of the service mode:
|
||||
|
||||
its('mode') { should eq 'replicated' }
|
||||
|
||||
### name
|
||||
|
||||
The `name` matcher tests the value of the service name:
|
||||
|
||||
its('name') { should eq 'foo' }
|
||||
|
||||
### ports
|
||||
|
||||
The `ports` matcher tests the value of the service's published ports:
|
||||
|
||||
its('ports') { should include '*:8000->8000/tcp' }
|
||||
|
||||
### repo
|
||||
|
||||
The `repo` matcher tests the value of the repository name:
|
||||
|
||||
its('repo') { should eq 'alpine' }
|
||||
|
||||
### replicas
|
||||
|
||||
The `replicas` matcher tests the value of the service's replica count:
|
||||
|
||||
its('replicas') { should eq '3/3' }
|
||||
|
||||
### tag
|
||||
|
||||
The `tag` matcher tests the value of image tag:
|
||||
|
||||
its('tag') { should eq 'latest' }
|
||||
|
|
Loading…
Reference in a new issue