Improve kernel test dates to prevent "random" fails

Created on 13 February 2023, almost 2 years ago

Problem/Motivation

In the kernel test we create node revisions with a created date ($i * 31) days. Apparently this could sometimes cause the tests to fail.

Proposed resolution

Using (($i * 31) + 1) seems to fix it.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇳🇱Netherlands seanB Netherlands

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @seanB
  • @seanb opened merge request.
  • @seanb opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇳🇱Netherlands seanB Netherlands
  • 🇳🇱Netherlands seanB Netherlands

    The code below currently seems to break the tests. The queue table might not exist the first time something is added to the queue, so we can't query it. We should check if the queue table exists.

      public function nodeExistsInQueue(int $nid): int {
        $query = $this->connection->select(DatabaseQueue::TABLE_NAME, 'q');
        $query->condition('name', 'node_revision_delete');
        $query->condition('data', serialize($nid));
        $query->condition('expire', 0);
        $query->fields('q', ['item_id']);
    
        $result = $query->execute()->fetchCol();
    
        return !empty($result) ? $result[0] : 0;
      }
    
  • 🇳🇱Netherlands seanB Netherlands

    Pushed a commit to add a check if the queue table exists.

Production build 0.71.5 2024