serverspec

Checking on empty gems cache fails using Serverspec for Docker image build testing

故事扮演 提交于 2019-12-24 10:23:03
问题 I'm currently having an issue with testing Docker image builds by means of Serverspec. In a nutshell, what I want to do is ensuring that during the image build the Ruby gems build cache gets cleared explicitly, e.g. by issuing rm -rf /usr/lib/ruby/gems/*/cache/*.gem in the Dockerfile. The Dockerfile skeleton I'm working with looks like this: # Dockerfile FROM alpine:3.7 RUN apk add --no-cache \ dumb-init \ ruby \ && apk add --no-cache --virtual .build-deps \ build-base \ ruby-dev RUN gem

serverspec service test returns incorrect failure

不打扰是莪最后的温柔 提交于 2019-12-12 05:51:41
问题 Why does this test return a failure? I'm using serverspec 2. 1) Service "cfengine3" should be enabled Failure/Error: it { should be_enabled } expected Service "cfengine3" to be enabled sudo -p 'Password: ' /bin/sh -c chkconfig\ --list\ cfengine3\ \|\ grep\ 3:on From spec file: describe service( 'cfengine3' ) do it { should be_enabled } end Manual test on host: newatson@atlspf01:~$ sudo /bin/sh -c chkconfig\ --list\ cfengine3\ \|\ grep\ 3:on cfengine3 0:off 1:off 2:on 3:on 4:on 5:on 6:off

serverspec - can 'should_be_owned_by' check multiple owners

和自甴很熟 提交于 2019-12-11 10:35:13
问题 I'm new to ServerSpec, Rspec, ruby so don't have much knowledge of the specifics of the grammar available. I'd like to write a test that does something like: describe file("foo") do it { should_be_owned_by 'bill' or 'ted' } end That test runs but seems to only check the first owner and not the second. Is there a standard way to perform a test where there may be multiple acceptable values? Thanks 回答1: I can not find it in the official file documentation, but you can use a grep regular

Rake / Rspec: How to suppress / quiet / silent the first output line showing the command with --pattern ?

牧云@^-^@ 提交于 2019-12-10 14:55:16
问题 Problem: If I run ServerSpec (based on RSpec ) through Rake with one of the following commands: rake rake spec rake spec:all rake spec:<host> bundle exec rake ... Rake prints the command it executes to stdout before the serverspec output: /usr/bin/ruby1.9.1 -I/var/lib/gems/1.9.1/gems/rspec-core-3.1.6/lib:/var/lib/gems/1.9.1/gems/rspec-support-3.1.2/lib /var/lib/gems/1.9.1/gems/rspec-core-3.1.6/exe/rspec --pattern spec/<host>/\*_spec.rb If I pass the target host manually to rspec like this ...