Is there a syntax to remove the \n from the chef inspec output

250 Views Asked by At

When executing the below command:

  describe sql.query("show pgaudit.log;") do
    its("output") { should match 'ERROR: unrecognized configuration parameter "pgaudit.log"' }
  end

Getting error as below, is there any error with the syntax, kindly advise.

 expected: "ERROR: unrecognized configuration parameter \"pgaudit.log\""
      got: "\nERROR:  unrecognized configuration parameter \"pgaudit.log\"\n"
1

There are 1 best solutions below

0
On BEST ANSWER

you just have to run the query before the describe block, strip it and then use expect on it. something like:

sql_query = sql.query("show pgaudit.log;")
describe sql_query do
  its("output") { 
    expect(sql_query.stdout.strip).to eq('ERROR: unrecognized configuration parameter "pgaudit.log"')
  }
end