ruby / openssl

Provides SSL, TLS and general purpose cryptography.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macos-latest truffeeruby-head: test_basic_response_response_operations failing

junaruga opened this issue · comments

I faced the following failure in macos-latest truffeeruby-head at #694. The PR is not related to this failure.

https://github.com/ruby/openssl/actions/runs/6894315128/job/18755841590?pr=694#step:9:611

1) Failure: test_basic_response_response_operations(OpenSSL::TestOCSP):
  <2023-11-16 17:26:22 +0000> -/+ <1> was expected to include
  <2023-11-16 17:26:24 UTC>.
  
  Relation:
  <<2023-11-16 17:26:22 +0000>-<1>[2023-11-16 17:26:21 +0000] <= <2023-11-16 17:26:22 +0000>+<1>[2023-11-16 17:26:23 +0000] < <2023-11-16 17:26:24 UTC>>
/Users/runner/work/openssl/openssl/test/openssl/test_ocsp.rb:231:in `test_basic_response_response_operations'
     228:     assert_equal OpenSSL::OCSP::V_CERTSTATUS_REVOKED, single.cert_status
     229:     assert_equal OpenSSL::OCSP::REVOKED_STATUS_UNSPECIFIED, single.revocation_reason
     230:     assert_equal now - 400, single.revocation_time
  => 231:     assert_in_delta (now - 301), single.this_update, 1
     232:     assert_equal nil, single.next_update
     233:     assert_equal [], single.extensions
     234: 
<internal:core> core/throw_catch.rb:36:in `catch'
<internal:core> core/throw_catch.rb:36:in `catch'

It seems the failure can randomly happen.

I don't see the failure with the same commit in GitHub Actions in my forked repository.
https://github.com/junaruga/ruby-openssl/actions/runs/6894314649

The test case:

    now = Time.at(Time.now.to_i)
    bres.add_status(cid1, OpenSSL::OCSP::V_CERTSTATUS_REVOKED, OpenSSL::OCSP::REVOKED_STATUS_UNSPECIFIED, now - 400, -300, 

    assert_in_delta (now - 301), single.this_update, 1

This does seem to be problematic. This test case fails if the clock advances by a second between the first line and the second line.

Oh I see. Thanks for the PR!