yiisoft / yiisoft/cache-db

Flaky test AbstractDbCacheTest::testSetMultiple

Open
#97 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:test
Dominant language
PHP
Stars
13
Forks
9
Avg merge
1h 8m
Merged PRs (30d)
1

Description

Sometimes fails due to time lag.

..F............................................................  63 / 124 ( 50%)
.............................................................   124 / 124 (100%)

Time: 00:23.671, Memory: 22.00 MB

There was 1 failure:

1) Yiisoft\Cache\Db\Tests\Driver\Oracle\DbCacheTest::testSetMultiple with data set #1 (2)
Failed asserting that null matches expected 1.

/home/runner/work/cache-db/cache-db/tests/Common/AbstractDbCacheTest.php:553
/home/runner/work/cache-db/cache-db/tests/Common/AbstractDbCacheTest.php:177

Test code:
https://github.com/yiisoft/cache-db/blob/aa6a67f4d8b712e8251e5451e18cf7631d5748f6/tests/Common/AbstractDbCacheTest.php#L170-L179

Cache expire precision is 1 second, so

  • 1.99: execute setMultiple with ttl = 2 -> expire is set to 3 (time() = 1 + 2 seconds)
  • 2.00: execute get -> ok,
  • 2.09: execute get -> ok
  • 3.00: execute get -> fail

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tests/Common/AbstractDbCacheTest.php around lines 170-179 and 553, then run the focused Oracle DbCacheTest::testSetMultiple test. Review how the test handles the one-second cache-expiration precision and verify that the timing-boundary failure is eliminated without weakening the expiration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.