WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#31994 closed defect (bug) (fixed)

WP should not autodetect pretty permalinks during unit test installation

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

The new-in-4.2 wp_install_maybe_enable_pretty_permalinks(), called from wp_install(), works by sending a couple of remote requests to a dummy URL. The 5-second timeout for each of these checks is negligible during a normal installation. But adding ten seconds to the process of running phpunit is pretty crippling for dev work - especially since our unit tests assume that pretty permalinks are disabled by default.

The attached patch is a suggested fix that doesn't require touching /src/. Not sure if it's kosher to slip this in for 4.2.

Attachments (1)

31994.diff (1.5 KB) - added by boonebgorges 4 years ago.

Download all attachments as: .zip

Change History (7)

@boonebgorges
4 years ago

#1 @helen
4 years ago

I'm fine with this happening in trunk now, related to 4.2 but essentially separate.

#2 @jorbin
4 years ago

  • Keywords commit added

This looks like a quality change to me as well and worthy of going into trunk.

#3 follow-up: @DrewAPicture
4 years ago

  • Keywords commit removed

Seems sensible, however I ran a total of eight test runs, four times each before and after the patch and based on my small sample, it actually ran slower with this change, though negligible.

Before patch:
1: 2.59 min
2: 2.52 min
3: 2.54 min
4: 2.62 min
Average: 2.56 min

After:
1: 2.57 min
2: 2.74 min
3: 2.77 min
4: 2.61 min
Average: 2.67 min

#4 @DrewAPicture
4 years ago

  • Keywords commit added

Didn't mean to remove the keyword :)

#5 in reply to: ↑ 3 @boonebgorges
4 years ago

Replying to DrewAPicture:

Seems sensible, however I ran a total of eight test runs, four times each before and after the patch and based on my small sample, it actually ran slower with this change, though negligible.

Yeah, those numbers are not significant. A bit more detail about the problem: wp_install_maybe_enable_pretty_permalinks() tries to ping your own domain. On the default test setup, that means 'example.org/2015/04/16/hello-world' or something like that. I was running into this problem because I was on a slow internet connection, which meant that example.org DNS lookups were timing out. If you don't have a lousy internet connection handy, you can reproduce the problem by finding a domain name that responds very slowly to pings, and using it as your 'WP_TESTS_DOMAIN'.

#6 @boonebgorges
4 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 32139:

During PHPUnit tests, don't autodetect permalink structure during WP installation.

The unit tests expect non-pretty permalinks, so there's no benefit to detecting
the ability to have pretty permalinks. Moreover, the wp_remote_get() call can
cause installation to hang when there are DNS issues.

Fixes #31994.

Note: See TracTickets for help on using tickets.