めんてなのおしごと

Wed, Apr 10, 2019 in debian debian

fluentdパッケージングでのテストエラー続き。

? Encoding: US-ASCII-8BIT
===============================================================================
: (0.005571)
    test: should output compressed file when compress option is gzip:   F
===============================================================================
Failure: test: should output compressed file when compress option is gzip(FileOutputSecondaryTest::write)
/build/fluentd-1.4.2/test/plugin/test_out_secondary_file.rb:129:in `check_gzipped_result'
/build/fluentd-1.4.2/test/plugin/test_out_secondary_file.rb:154:in `block (2 levels) in <class:FileOutputSecondaryTest>'
     151:       path = d.instance.write(@chunk)
     152: 
     153:       assert_equal "#{TMP_DIR}/out_file_test.0.gz", path
  => 154:       check_gzipped_result(path, @es.to_msgpack_stream.force_encoding('ASCII-8BIT'))
     155:     end
     156: 
     157:     test 'should output plain text when compress option is default(text)' do
<"\x92\xD7\x00\\\xAC\x83\x81\x04\x04Z\x9F\x81\xA3key\xA5value">(ASCII-8BIT) expected but was
<"\x92\xD7\x00\\\xAC\x83\x81\x04\x04Z\x9F\x81\xA3key\xA5value">(US-ASCII)

diff:
  ^@\ャメ^D^DZ氈keyvalue

文字列の比較のようだが、同じ様に見える…のにエンコーディングが違う?どこでこのエンコーディング指定してるのだろう?とTravis CIのログをみてなるほどーとなってパッチ。

  Gem2Deb::Rake::TestTask.new do |t|
    t.libs = ['test']
    t.test_files = FileList['test/**/*_test.rb'] + FileList['test/**/test_*.rb']
+   t.ruby_opts = ["-Eascii-8bit:ascii-8bit"]
  end

しかし、エラーがどうしても一つ潰せず、upstreamにIssueを上げた