简体   繁体   中英

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

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"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM