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
0
votes
1 answer

How to signal to RSpec that an expectation has failed for a custom Serverspec resource type

I have written the serverspec resource type below for checking if keys have the right values for some YAML configuration files I have For each key in the hash table I assign an attribute on the resource type instance. If a key does not exist I'd…
the_drow
  • 18,571
  • 25
  • 126
  • 193
0
votes
1 answer

Issue with Serverspec test run

I have the following scenario regarding serverspec run: I login to VM using user certificate and then do a sudo su -. Now as a root, I switch to dummy user which requires no password. Then using the dummy user I initialize serverspec using …
KronnorK
  • 539
  • 5
  • 17
0
votes
2 answers

serverspec service test returns incorrect failure

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\…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
0
votes
1 answer

ServerSpec failing on Windows 7 when running tests

I recently tried to create a ServerSpec job, using Ruby 2.1.6 for Windows. However, using the code at the following GitHub repo, I get the following errors. C:\Users\PD028300\Desktop\serverspec_test\windows_spec λ rake…
FilBot3
  • 3,460
  • 6
  • 33
  • 55
0
votes
2 answers

What are some goals or best practices when testing a package install with ServerSpec?

So, I've successfully used Vagrant and Chef to install an MSI onto a Windows guest VM. Woot! Then, I wrote a few tests with ServerSpec that check that after the MSI was installed, files got put into their proper places and things like that. My…
NickRamirez
  • 340
  • 4
  • 10
0
votes
2 answers

For loop in serverspec

I have this Spec file: require 'spec_helper' for i in 1..3 describe file ("/var/tmp/efl_test_0#{i}_link" )do it { should be_linked_to "/tmp/efl_test_0#{i}" } end end The expected results are: /var/tmp/efl_test01_link should…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
0
votes
1 answer

First "should be_installed" in test always fails on Windows

First off, I'm using serverspec 2.3.1 and specinfra 2.4.2, with Ruby 1.9.3p550 I am still investigating the problem, but I figured I'd give a shot at asking here in case someone encountered the problem before (and if not and I figure it out, maybe…
gCardinal
  • 632
  • 2
  • 9
  • 27
0
votes
1 answer

Chef ServerSpec Regex Match Not Working

I'm trying to math a regex to the stdout of a command. Even though the regex should match it doesn't seem to be doing as such: > [#] Command "pm2 list" > [#] stdout > [#] should match /.*online.*/ (FAILED - 1) > [#] > [#] …
localhostv6
  • 47
  • 1
  • 5
0
votes
1 answer

Chef ServerSpec Host Resource Not Working

I'm trying to write a ServerSpec test to run against a deployed instance. The following is the relevant test: require 'spec_helper' describe service('nginx') do it { should be_enabled } it { should be_running } end describe port(80) do it {…
localhostv6
  • 47
  • 1
  • 5
0
votes
1 answer

How to specify version of specinfra for test-kitchen verify command?

Last version of https://github.com/serverspec/specinfra is broken (https://github.com/serverspec/specinfra/pull/229). so when I execute: kitchen verify it doesn't verify and just throw some errors. So I thought - How to specify some particular…
Kostiantyn
  • 23
  • 3
-1
votes
1 answer

how to invoke bundler commands from within a Serverspec/RSpec test

I have a project to create a template ruby project. I am using serverspec and want to verify the behaviour of the template. However, using command(`rake -T`) fails. If I execute the command manually, it works as expected. Debugging, when the test…
Tim
  • 726
  • 5
  • 18
-1
votes
2 answers

How to execute multiple serverspec files at once?

We are writing serverspec ruby scripts. We are writing multiple scripts as each script validates certain portion of the application. how to run all the scripts together and get one final report?
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
-1
votes
1 answer

Stop SSH password prompts in serverspec

I'm in an environment with authentication tokens, so typically a SSH password is not required. My serverspec tests are always asking me for a password. Is there a way to prevent this? No password required: $ ssh atlspf01 newatson@atlspf01:~$ Yet,…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
-2
votes
1 answer

Command Path issue with serverspec, need steps for ansible

I've installed serverspec on my server command to execute serverspec is serverspec-init. But this is working for me only when I do the full command path. /usr/local/lib/ruby/gems/2.7.0/gems/serverspec-2.41.5/bin/serverspec-init but when i do export…
akp
  • 1
  • 1
-2
votes
2 answers

Use a regex to check cron entry '0 5 * * * /usr/bin/aide --check'

How do I check the cron entry 0 5 * * * /usr/bin/aide --check with a regex? I would like to check this in Chef InSpec like its('content') { should match // }
user3121011
  • 449
  • 3
  • 12