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
0 answers

Serverspec ssh results in: OS detection failed

I just recently got an issue with the net-ssh gem usage for my Linux remote host. To exclude any strange environment a clean serverspec-init was performed with Linux/SSH options selected and the corresponding remote host. Furthermore I adjusted the…
E Sturzenegger
  • 159
  • 4
  • 12
0
votes
1 answer

How can I make same working code without contain matcher in ServerSpec

describe file('/etc/checkfiles/server.cfg') do its(:content) { should contain("\/usr\/lib64\/nagios\/plugins\/check_procs -w 150 -c 200") .after(/command\[check_total_procs\]\=/) } end I'm using contain matcher like this code, but it…
Harley G.
  • 23
  • 4
0
votes
0 answers

Serverspec test fail when i run its pipeline from other pipeline

I'm running 3 pipelines in jenkins (CI, CD, CDP) when I run the CI pipe the final stage is a trigger for activate the pipe CD (Continuous Deployment), this receive a parameter APP_VERSION from CI (Continuous Integration) PIPE and deploy an instance…
0
votes
0 answers

Test Kitchen is Broken on Ubuntu 18.04 Because of Rspec Mismatch

I've run tests in the same environment for weeks now without issues. Just today I started getting errors: /opt/chef/embedded/bin/ruby -I/tmp/verifier/suites/serverspec…
Ken Jenney
  • 422
  • 7
  • 15
0
votes
1 answer

Does Serverspec support expectations or do I have to use should?

I hear I should be using expectations rather than "should" statements in Serverspec I have been Googling around for expectations that can be used for file matching but all of the tutorials I see for Serverspec use should rather than expect. Is this…
Kaliklipper
  • 355
  • 5
  • 19
0
votes
1 answer

Construction Rakefile to test ports using server-spec - getting 0 examples, 0 failures

In my test scenario, I need to test for ports status on a set of various OS servers. I have constructed my Rakefile as follow: require 'rake' require 'rspec/core/rake_task' hosts = %w( //list of Ux servers server1 //list of Win…
0
votes
2 answers

How to test if my ServerSpec command condition written in Ruby works?

I'm using the following ruby script describe command('curl -s -k - i %{http_code} https://localhost/xx/xxx') do its(:stdout) { should match /200/ } end But I'm unsure if this script works or not. How can I make sure this script works?
0
votes
0 answers

Run serverspec script in a jenkins build pipeline

how can i run a serverspec script in a jenkins pipeline? I try this node { stage('serverspec') { sh 'rake spec' } } but then I get the following error: Port "8080" should be listening Failure/Error: it { should be_listening } …
user5832678
0
votes
1 answer

Unable to run serverspec test on GCP packer instance

I am struggling to run serverspec test on GCP packer instance from local machine. I have created a packer json config file as follows to create an image on GCP: { "variables": { "project": "gcp-project", "image_family": "centos-7", …
0
votes
2 answers

What does Timeout.timeout(0) mean in chef server spec (Ruby)

I am trying to write server spec code for some service. I want to add the timeout so that if within given time, command doesn't responds, the test case should fail. When tried for timeout(0), test was passing. Does this mean that there is no…
0
votes
2 answers

Testing redirects using serverspec

I'm looking to create a test in serverspec for an nginx rewrite call like the one below (it re-directs requests for the ^/folder/file.json URL to the @redirect_url variable): rewrite ^/folder/file.json <%= @redirect_url %> permanent; For a Chef…
0
votes
1 answer

How do I get rspec to show me full failure traces

When I run the following failing test with kitchen verify describe command ('cat example.txt') do its(:stdout) { should contain('param1 50') } its(:stdout) { should contain('param2 77') } end I get the following failure trace : Command "cat…
B. Kev1n
  • 9
  • 2
0
votes
1 answer

Chef Serverspec should not listen

From this link I could see http://serverspec.org/resource_types.html#port describe port(80) do it { should be_listening } end I wanted to test the negative of it. Say I disabled a port and I don't want anything listening to that port. What…
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186
0
votes
0 answers

ServerSpec unable to execute tests against remote windows ami

I have a test machine that contains a serverspec test. This is a ubuntu machine and I want to run the test using WinRM against a windows machine. when executing the test it immediately fails, it looks like it is trying to run the test locally and…
JaChNo
  • 1,493
  • 9
  • 28
  • 56
0
votes
1 answer

How to access Mysql DB variables in Serverspec? can we do it using PowerShell?

I want to access DB variables using Serverspec, but in Serverspec for Windows it is not supported so I am trying using PowerShell but got the following issues Tried using below powershell command: "cd Program\ Files\\MySQL\\MySQL\ Server\…