From 6af01906b274d40efd302a72b3ec62b9b6054994 Mon Sep 17 00:00:00 2001 From: Luis Blanco <108473576+ljblancoredborder@users.noreply.github.com> Date: Thu, 13 Jun 2024 08:44:53 +0100 Subject: [PATCH] Bugfix/#16981 wakeup chef script status (#71) rb_wakeup_chef test by @ljblancoredborder --- README.md | 4 ++++ spec/configuration/chef_spec.rb | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 spec/configuration/chef_spec.rb diff --git a/README.md b/README.md index 75efc2a..8356f1d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ On your workstation, execute the following command in your terminal: ```ssh bundle install ``` +Also make sure to share your public ssh key to target machine: +``` +ssh-copy-id root@ +``` ## Running Tests To run all tests, use the following command: diff --git a/spec/configuration/chef_spec.rb b/spec/configuration/chef_spec.rb new file mode 100644 index 0000000..c63cc42 --- /dev/null +++ b/spec/configuration/chef_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'spec_helper' +set :os, family: 'redhat', release: '9', arch: 'x86_64' + +describe file('/usr/lib/redborder/bin/rb_wakeup_chef.sh'), :rb_wakeup_chef do + it { should exist } + it { should be_file } + it { should be_executable.by_user('webui') } +end + +describe 'Checking WakeUpClusterJob' do + query_psql = "echo \"SELECT * FROM stored_delayed_jobs WHERE job='RbWakeupChefClusterJob';\" | rb_psql redborder" + describe command(query_psql) do + its(:exit_status) { should eq 0 } + its(:stdout) { should_not match(/Errno::EACCES: Permission denied/) } + end +end