WordPress / WordPress/phpunit-test-runner

Reuse of file names restricts concurrent runs

Open
#77 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement help wanted needs assignee WCUS26
Dominant language
PHP
Stars
77
Forks
77
Avg merge
15d 15h
Merged PRs (30d)
4

Description

This is more of a feature request, and may be similar to issues #1 and #6, but I feel the scope may be different then the resolutions mentioned there.

I have found that I receive errors, or have the potential for inconsistent results if I am running multiple instances concurrently, or if previous tests failed. Specifically, I am seeing that certain file names are being reused for multiple tests. Some example names include:

/tmp/waffles-300x225.jpg
/tmp/waffles.jpg
/tmp/canola.jpg
/tmp/canola-150x150.jpg

As you could suspect from the directory, on my system the temp directory is set globally to /tmp, which means that if two different users attempt to run the tests at the same time, it fails because of user permissions issues. The symptoms may not be important for most people, as they are likely using only a single user to run the tests on a given machine. However, as I have seen those files remaining after certain runs, perhaps after a failed run, I had suspected that they might cause problems if they remain until the next run for that same user.

In my environments, I am running the scripts directly on certain servers which will be hosting WordPress with the intention of having more accurate results.

If this is a problem, I would recommend adding some other information onto the file names, perhaps such as a hash value, or perhaps by adding in an ID for the run.

Contributor guide

No contributing guide indexed for this repository

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 by locating the test-runner code that creates /tmp/waffles-300x225.jpg, /tmp/waffles.jpg, /tmp/canola.jpg, and /tmp/canola-150x150.jpg. Run concurrent or interrupted tests to reproduce collisions; done means separate runs no longer reuse conflicting temporary file names or fail because of permissions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.