Skip to content

Transient failures of test/encryption_test.rb #632

@andrykonchin

Description

@andrykonchin

I've noticed that tests may fail on CI on TruffleRuby (e.g. here).

I can reproduce the issue on CRuby as well (using v3.3.5) if run the failed test multiple times in a loop (the test usually passes if run it only once):

$ ruby -I lib -I test test/encryption_test.rb
Run options: --seed 35559

# Running:

F.

Finished in 0.330569s, 6.0502 runs/s, 2063.1094 assertions/s.

  1) Failure:
EncryptionTest#test_encrypt [test/encryption_test.rb:47]:
--- expected
+++ actual
@@ -1 +1,4 @@
-"\nAUTOMAKE_OPTIONS = gnu\n\nEXTRA_DIST = test.zip\n\nCXXFLAGS= -g\n\nnoinst_LIBRARIES = libzipios.a\n\nbin_PROGRAMS = test_zip test_izipfilt test_izipstream\n# test_flist \n\nlibzipios_a_SOURCES = backbuffer.h    fcol.cpp           fcol.h           \\\n                      fcol_common.h   fcolexceptions.cpp fcolexceptions.h \\\n                      fileentry.cpp   fileentry.h        flist.cpp        \\\n                      flist.h         flistentry.cpp     flistentry.h     \\\n                      flistscanner.h  ifiltstreambuf.cpp ifiltstreambuf.h \\\n                      inflatefilt.cpp inflatefilt.h      izipfilt.cpp     \\\n                      izipfilt.h      izipstream.cpp     izipstream.h     \\\n                      zipfile.cpp     zipfile.h          ziphead.cpp      \\\n                      ziphead.h       flistscanner.ll\n\n# test_flist_SOURCES = test_flist.cpp\n\ntest_izipfilt_SOURCES = test_izipfilt.cpp\n\ntest_izipstream_SOURCES = test_izipstream.cpp\n\ntest_zip_SOURCES = test_zip.cpp\n\n# Notice that libzipios.a is not specified as -L. -lzipios\n# If it was, automake would not include it as a dependency.\n\n# test_flist_LDADD = libzipios.a\n\ntest_izipfilt_LDADD = libzipios.a -lz\n\ntest_zip_LDADD = libzipios.a -lz\n\ntest_izipstream_LDADD = libzipios.a -lz\n\n\n\nflistscanner.cc : flistscanner.ll\n\t$(LEX) -+ -PFListScanner -o$@ $^\n\n"
+# encoding: ASCII-8BIT
+#    valid: true
+"k\r\xAF`7
+1jK\xDC\xF9#^\xD7\xAC"


2 runs, 682 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /Users/andrykonchin/projects/truffleruby-gems-to-test/rubyzip/coverage.
Line Coverage: 60.9% (1106 / 1816)
Branch Coverage: 21.76% (131 / 602)
Lcov style coverage report generated for Unit Tests to coverage/lcov.info

Changes in the test/encryption_test.rb file:

diff --git a/test/encryption_test.rb b/test/encryption_test.rb
index 0561281..abed213 100644
--- a/test/encryption_test.rb
+++ b/test/encryption_test.rb
@@ -20,7 +20,7 @@ class EncryptionTest < MiniTest::Test
     test_filename = 'top_secret_file.txt'

     password = 'swordfish'
-
+300.times do
     encrypted_zip = Zip::OutputStream.write_buffer(
       ::StringIO.new,
       encrypter: Zip::TraditionalEncrypter.new(password)
@@ -48,6 +48,7 @@ class EncryptionTest < MiniTest::Test
       end
     end
     assert_match(/Zlib error \('.+'\) while inflating\./, error.message)
+end
   end

   def test_decrypt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy