Questions tagged [serverspec]

Serverspec provides ruby RSpec tests for checking your servers are configured correctly. It tests the servers actual state by executing commands locally, via SSH, WinRM or Docker API

Serverspec provides ruby RSpec tests for checking your servers are configured correctly. It tests the servers actual state by executing commands locally, via SSH, WinRM or Docker API

106 questions
9
votes
1 answer

Testing multiple hosts with the same test using serverspec

The Advanced Tips section of the Serverspec site shows an example of testing multiple hosts with the same test set. I've built an example of my own (https://gist.github.com/neilhwatson/81249ad393800a76a8ad), but there are problems. The first problem…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
6
votes
1 answer

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

Problem: If I run ServerSpec (based on RSpec) through Rake with one of the following commands: rake rake spec rake spec:all rake spec: bundle exec rake ... Rake prints the command it executes to stdout before the serverspec…
Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
5
votes
1 answer

Continue multi-host tests even on failure

I've built some serverspec code to run a group of tests on multiple hosts. The trouble is that the testing stops at the current host when any test fails. I want it to continue to all hosts even if a test fails. The Rakefile: namespace :spec do …
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
4
votes
2 answers

Check content of file with InSpec if it exists

I'm writing a Chef InSpec test in ruby to check the contents of the files for 'umask 077'. The issue is that for a few of the files in my array that I'm checking for do not exist. I'm trying to exclude nil files and re-push them, but it seems to…
Blooze
  • 1,987
  • 4
  • 16
  • 19
4
votes
1 answer

Test-Kitchen serverspec testing exception on windows

When using chef generate cookbook hello command, the serverspec spec_helper.rb file generated will not work with Test-Kitchen 1.4.1 and windows. kitchen verify command will throw the following on windows…
Dennis Hoer
  • 3,039
  • 2
  • 23
  • 34
4
votes
2 answers

undefined method `before' for main:Object

I'm getting the above error from section of code below. What is the cause? 1 require 'spec_helper' 2 3 before(:all) do 4 puts "ServerSpec tests on #{ENV['TARGET_HOST']}" 5 end Full…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
3
votes
1 answer

Serverspec doesn't check package version correctly

I have a problem with serverspec. I'm trying to check installed package version on ubuntu. I use this code: describe 'java packages' do it 'package openjdk-9-jre should be installed with the correct version' do …
esio
  • 1,592
  • 3
  • 17
  • 30
3
votes
1 answer

How to use Serverspec to test the utility installed in other user?

My requirement is that I need to run a utility that is installed in other user and I have to check the output returned from that session and verify it. Example : I installed java as srijava user Now in Serverspec I wrote the command to test the…
Sri
  • 41
  • 4
3
votes
2 answers

In chef, is it possible to include serverspec tests of one cookbook into another cookbook?

Consider this, I have two cookbooks A and B with each having their own integration testing using serverspec tests and kitchen. Everything works fine if I want to test just one cookbook against its own test suites. Now, if I create a cookbook C that…
Magnus
  • 73
  • 8
3
votes
1 answer

Serverspec: Check if directory is empty

I want to check, if an existing directory is empty (does not contain any files or sub-directories). I tried the following: describe file('/path/to/file') do it { should be_empty } end But this doesn't work. (Of course, as it is not mentioned…
René Schubert
  • 1,302
  • 2
  • 13
  • 31
3
votes
1 answer

How to require cookbook libraries in kitchen serverspec tests

On a cookbook I defined a class Rds::Checks that shares methods for building unix commands for bash/execute resources and Guards. A sample of the file libraries/checks.rb is: module Rds class Checks class << self def…
sekipaolo
  • 135
  • 2
  • 7
3
votes
3 answers

Chef ServerSpec SpecInfra Uninitialized Constant NameError

I've run into an issue when using ServerSpec to run integration test on my Chef cookbooks. When I attempted to run the test today, without making any changes, I got the following error: tl;dr /tmp/busser/suites/serverspec/spec_helper.rb:3:in
localhostv6
  • 47
  • 1
  • 5
2
votes
1 answer

Is there a way to test whether a particular version of java or tomcat is installed during deployment using rspec-serverspec?

I have an environment built by using puppet. I was planning to write some rspec-ruby script that can be executed once the puppet build is complete to test whether all the directories, packages, users and roles are created. What I would like is to…
Sunil Cyriac
  • 413
  • 4
  • 16
2
votes
1 answer

using variable in the the command resource in serverspec

I have the following test in a serverspec recipe - the hash is just the whole resource as it is described in Chef (I am hoping to pipe that in at some point) # Test Folder Permissons # hash taken from attributes share = { "name" => "example", …
2
votes
3 answers

Is it possible to run kitchen tests against a server without using any drivers?

I just want to see if it's possible to run kitchen tests against a server that's always on. I know that testing cookbooks against VMs that you can create and destroy at will would be ideal, but I would expect there to be some stripped down way of…
arjabbar
  • 6,044
  • 4
  • 30
  • 46
1
2 3 4 5 6 7 8