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

Why does serverspec connect to the localhost instead of the remote host

My serverspec example, setup using serverspec-init, then I generated this simple test file ./spec/altspf01/sample_spec.rb require 'spec_helper' describe command( '/bin/hostname -s' ) do its(:stdout) { should match /atlspf01/ } end I expect it…
Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
1
vote
2 answers

Unable to run serverspec files on different hosts

I'm writing tests per host using serverspec. My file are organized as follows.. |-- Rakefile `-- spec |-- spec_helper.rb `-- www.example.jp `-- example_spec.rb `-- spec_helper.rb The contents of the Rakefile is…
1
vote
1 answer

Serverspec error: "Don't know how to build task"

I'm having an issue with Serverspec. I'm trying to test an infrastructure deployed on a cloud VM, from a CloudBees jenkins build server using ansible. I created a test for each ansible role using Serverspec. Right now I'm just trying to check if I…
Sebiwi
  • 109
  • 2
  • 12
1
vote
2 answers

How to setup test preconditions before a ServerSpec test?

I am writing a simple cookbook that will be used to deploy an SSL proxy onto a server. This cookbook will ultimately be used by other cookbooks that deploy web services in order to set up an SSL proxy in front of them, but for the purpose of…
Kenneth Baltrinic
  • 2,941
  • 2
  • 28
  • 45
1
vote
0 answers

Puppet Spec and Test kitchen

How can I override log format of serverspec and extract in a separate file? I am able to to do this but not able to extract in separate file. My code snippet is : RSpec.configure do |c| c.output_stream = File.open('serverspec-result.json',…
sencha7
  • 51
  • 1
  • 4
1
vote
1 answer

How to set delay between converge and verify on kitchen test?

I'm running Serverspec integration smoke tests with Test Kitchen on a system built with Vagrant+Chef Solo. When i run kitchen test then the tests are started right after successful converge, and some of my tests fail because it takes time for the…
k6ps
  • 359
  • 4
  • 11
1
vote
1 answer

How do I test for the value of a variable in serverspec

I have a fairly simple task to complete. I'm writing a number of tests for a Chef project I'm working on. Serverspec gives you resources such as command, file, etc. What I want to do is simply check for the value of a variable, ie: someVar = "some…
Derek
  • 4,575
  • 3
  • 22
  • 36
1
vote
0 answers

How to run serverspec tests against localhost using sudo for all commands?

Serverspec automatically prepends sudo to every command when using SSH to execute the tests on a remote host. This works great, but I am looking to run my serverspec tests locally and many of my tests require sudo privileges. I am using RVM and…
Jason
  • 2,115
  • 15
  • 21
1
vote
1 answer

When running SeverSpec test, `initialize': getaddrinfo: Name or service not known (SocketError) error is occurred

I am new to Serverspec testing tool. When running test, I got the following error. [root@ost-svr004 serverspec]# rake spec /usr/bin/ruby -I/usr/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib:/usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib…
1
vote
1 answer

Is it possible to include common-tests in serverspec?

I'm using serverspec to carry out remote testing of servers. I've a number of different tests, which all work fine: `-- spec |-- builder.example.org.uk \ host_spec.rb |-- chat.example.org.uk \ host_spec.rb |--…
user14038
0
votes
0 answers

Serverspec: test file owned only by root

I'm running some tests using serverspec/rspec and I want to test that this file owned only by root exists and it's content: require 'spec_helper' describe port(9252) do it { should be_listening } end describe…
0
votes
1 answer

WORKGROUP\user: No Mapping between account names and Security Id was done,

I installed PostgreSQL using Chocolaty and Beaker tests in Windows Server, but I got this error WORKGROUP\user: No Mapping between account names and Security Id was done. Then: Initdb: Error: could not access directory ¯d: /postgres/data®:…
0
votes
1 answer

serverspec test fails for listening port

I got a kitchen-ansible test that runs serverspec as a verifier. The test runs on two containers. One running with Amazon Linux 1 and the other Amazon Linux 2. The Ansible code installs a Keycloak server which listens on the ports 8080 and 8443. In…
audioslave
  • 125
  • 1
  • 1
  • 11
0
votes
2 answers

How to automate the manual input for command in bash script

I have command called serverspec-init which prompts Select OS type: 1) UN*X 2) Windows Select number: Now I have manually enter value 1 or 2. But I want to automate this so when i run script it automatically pick the value from variable and…
akp
  • 1
  • 1
0
votes
0 answers

Serverspec test statements for content linking to sections in file

I have a file, with sections of content as following. I need to write server spec test file for portnumbers as it belongs to their respective section, as a part of puppet automation of a product. path: etc/a.Cfg file Global user abc group…
gopi r
  • 1
  • 1