繁体   English   中英

是否有从厨师检查 output 中删除 \n 的语法

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

执行以下命令时:

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

出现如下错误,语法是否有任何错误,请指教。

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

您只需要在describe块之前运行查询,将其剥离,然后在其上使用expect 就像是:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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