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
1
vote
1 answer

Dockerfile test require directive unable to find the correct module

I am trying to write a basic test of an Ubuntu 16.04 docker image. My testing environment is Ubuntu 16.04 also and I have installed the ruby-serverspec package. require "serverspec" require "docker_image" describe "Dockerfile" do before(:all) do …
William
  • 337
  • 4
  • 14
1
vote
3 answers

Inspec/Serverspec grabbing multiple stdouts from command and describing them

I'm attempting to create an inspec control that searches through every line that starts with kernel (and ignores whitespace) in /boot/grub/grub.conf and then checking every line to see if it has 'nousb' somewhere in the line. I'd like it to return a…
Blooze
  • 1,987
  • 4
  • 16
  • 19
1
vote
1 answer

How to check whether the msi with particular version installed using serverspec?

We are trying to validate the application installation using ServerSpec in windows. I have written the following lines in ruby file (with Test.rb) require 'spec_helper' set :backend, :cmd set :os, :family => 'windows' describe…
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
1
vote
2 answers

"undefined method `[]' for nil:NilClass" error when running Serverspec test remotely

I have a Serverspec test using inifile gem: require 'spec_helper' require 'inifile' describe 'inifile test -' do file = '/tmp/testfile1.ini' file_ini = IniFile.load(file) it 'testfile1.ini should contain expected values' do …
techraf
  • 64,883
  • 27
  • 193
  • 198
1
vote
1 answer

Serverspec: "package should be installed" defaults to RPM. can't specify yum?

I have this serverspec test: describe package("python-pip") do it { should be_installed.with_version("6.1.1") } end It was failing and I noticed in the output that serverspec was checking packages installed with rpm default. Then I noticed…
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
1
vote
1 answer

Serverspec package check always returns true

I'm trying to write serverspec tests that check if a recipe is setting up mariadb-server, by using chef, kitchen, and vagrant, with a debian jessie box. The recipe is simple: # cookbooks/mariadb/recipes/server.rb package 'mariadb-server' do …
pdu
  • 10,295
  • 4
  • 58
  • 95
1
vote
1 answer

Installing Busser plugins: busser-serverspec never finishes (OSX, Virtualbox)

When I run kitchen test on my MacBook, it gets through most of the steps, but then gets stuck here twiddling its thumbs: Running handlers: Running handlers complete Chef Client finished, 81/117 resources updated in 07 minutes 12…
Andrew Evans
  • 897
  • 2
  • 7
  • 17
1
vote
1 answer

serverspec using environment variables in Rakefile

Serverspec is used to check on several servers. Therefore the recommend structure of roles is used: |-- Rakefile |-- spec |-- app | -- ruby_spec.rb |-- base | -- users_and_groups_spec.rb |-- db | -- mysql_spec.rb …
Capri90
  • 171
  • 7
1
vote
1 answer

Test if a firewall is blocking a port

I am writing a Chef cookbook which will, among other things, add some firewall rules. But before I do that I need to write a test for it. That's where I'm stuck! What I need is Serverspec/Rspec code that verifies that it is not possible to send data…
Christoffer Reijer
  • 1,925
  • 2
  • 21
  • 40
1
vote
1 answer

serverspec - can 'should_be_owned_by' check multiple owners

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…
CGJ
  • 11
  • 3
1
vote
1 answer

how do I test hiera values in puppet testing

I have below manifests in puppet: class env { $line = hiera('LINE') file { '/opt/dt/LINE' ensure => file, owner => 'root', group => 'root', mode => '0644', content => "${line}\n", } } I…
Puppeteer
  • 63
  • 1
  • 7
1
vote
2 answers

rspec/serverspec service test always fails

I believe this issue probably a duplicate of serverspec service test returns incorrect failure, but I include a bit more information of my execution environment. I have a bunch of successful serverspec tests executing against a RHEL6 VM on…
philbert
  • 478
  • 4
  • 15
1
vote
1 answer

How to control which user "kitchen verify" uses when testing a command resource?

I have a Chef cookbook that installs "git version 2.5.2". I'm using a CentOS 6.4 vm to apply this cookbook and have written a test to check the git version. The snippet looks like this: # Test if git exists describe command('git --version') do …
theNoob
  • 19
  • 4
1
vote
0 answers

Unable to override rspec_opts in test-kitchen/busser-serverspec

It seems that there's way to override rspec_opts. By default it is running with "--color --format documentation", like such: /opt/chef/embedded/bin/ruby -I/tmp/verifier/suites/serverspec…
Nicholas Key
  • 1,429
  • 4
  • 21
  • 24
1
vote
1 answer

TestKichen, Serverspec and out-of-order command execution

Inside TestKitchen describe blocks I'm running a command, loading its output into a variable then running multiple expect statements over that output validating different parts of it. The end goal is using this as part of CI builds to do blackbox…
Will L
  • 76
  • 6