#31491 closed task (blessed) (fixed)
Enhance unit tests for persistent object caching
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | needs-patch |
| Focuses: | Cc: |
Description (last modified by )
While running the tests with an object-cache.php drop-in (in this case Memcached) I got some failing tests:
There was 1 error:
1) Tests_Cache::test_switch_to_blog
Undefined variable: table_prefix
/srv/www/wp-develop/svn/src/wp-content/object-cache.php:316
/srv/www/wp-develop/svn/tests/phpunit/tests/cache.php:246
--
There were 6 failures:
1) Tests_Cache::test_wp_cache_init
Failed asserting that two objects are equal.
--- Expected
+++ Actual
@@ @@
'default' => Memcache Object (
- 'connection' => resource(765) of type (memcache connection)
+ 'connection' => resource(764) of type (memcache connection)
'_failureCallback' => Array (...)
)
)
'stats' => Array (...)
'group_ops' => Array ()
'cache_enabled' => true
'default_expiration' => 0
'global_prefix' => 'wptests_'
'blog_prefix' => 'wptests_:'
'cache_hits' => null
'cache_misses' => null
)
/srv/www/wp-develop/svn/tests/phpunit/tests/cache.php:284
2) Tests_Import_Import::test_small_import
Failed asserting that 0 matches expected 6.
/srv/www/wp-develop/svn/tests/phpunit/tests/import/import.php:175
3) Tests_Option_SiteTransient::test_the_basics
Failed asserting that true is false.
/srv/www/wp-develop/svn/tests/phpunit/tests/option/siteTransient.php:16
4) Tests_Option_Transient::test_the_basics
Failed asserting that true is false.
/srv/www/wp-develop/svn/tests/phpunit/tests/option/transient.php:16
5) Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_no
Failed asserting that 42579 matches expected 42580.
/srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:88
6) Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_false
Failed asserting that 42586 matches expected 42587.
/srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:113
FAILURES!
Tests: 3938, Assertions: 15029, Failures: 6, Errors: 1, Skipped: 16.
We should enhance these tests to make them work with a persistent object cache.
From @pento: "It'd be worth having a memcache variant of our Travis tests.". Sounds like a good idea to me.
Attachments (7)
Change History (41)
#2
@
11 years ago
31491.diff adds a memcache test (though it causes a warning in object-cache.php, along with the failures found by @ocean90).
I wanted to double check the use of the WP_MEMCACHE environment variable, is that the appropriate style for how we want our .travis.yml to evolve?
#3
@
11 years ago
And for an example of it running:
https://travis-ci.org/pento/develop.wordpress/jobs/52679925
#4
@
11 years ago
31491.2.diff tweaks the patch a little bit based on @netweb's feedback in Slack.
I haven't committed it, as I assume we don't want to commit things while tests are failing. :-)
#5
@
11 years ago
- Milestone changed from Awaiting Review to 4.4
- Owner set to ocean90
- Status changed from new to assigned
This needs to be done.
#7
@
11 years ago
1) Tests_Import_Import::test_small_import Failed asserting that 0 matches expected 6. /srv/www/wp-develop/svn/tests/phpunit/tests/import/import.php:175
The importer uses a query to update post_parent and not wp_update_post() which clears the cache. 31491.wordpress-importer.patch fixes that.
#10
@
11 years ago
5) Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_no Failed asserting that 42579 matches expected 42580. /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:88 6) Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_false Failed asserting that 42586 matches expected 42587. /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:113
These are because the cache doesn't get flushed correctly. 31491.cache-flush.patch uses WP_UnitTestCase::flush() to fix this.
But this seems to be a bug in the memcache drop-in because it should clear the $cache property by itself, see 31491-memcached.patch. @ryan, can you take a look at this and maybe commit?
@Otto42 or @nacin: Can you please commit 31491.wordpress-importer.patch to wordpress-importer/trunk?
#11
@
11 years ago
31491-skip-all-transient-as-options-tests.patch skips all current transient tests if an external object cache is in use. This will _fix_ the test_the_basics tests because the cache API has different return values, WP_Object_Cache::set() returns always true.
#12
@
11 years ago
I handed the memcached backend over to @markjaquith and @sivel. I don't maintain it anymore.
This ticket was mentioned in Slack in #core by sergey. View the logs.
10 years ago
#18
@
10 years ago
- Type changed from enhancement to task (blessed)
There are still some failing tests.
There were 7 failures:
1) Tests_Pluggable::testPluggableFunctionSignaturesMatch with data set #47 ('wp_cache_decr')
Parameter: n
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-offset
+n
/srv/www/wp-develop/svn/tests/phpunit/tests/pluggable.php:43
2) Tests_Pluggable::testPluggableFunctionSignaturesMatch with data set #50 ('wp_cache_get')
Failed asserting that 3 is identical to 4.
/srv/www/wp-develop/svn/tests/phpunit/tests/pluggable.php:26
3) Tests_Pluggable::testPluggableFunctionSignaturesMatch with data set #51 ('wp_cache_incr')
Parameter: n
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-offset
+n
/srv/www/wp-develop/svn/tests/phpunit/tests/pluggable.php:43
4) Tests_Pluggable::testPluggableFunctionSignaturesMatch with data set #58 ('wp_cache_reset')
Failed asserting that false is true.
/srv/www/wp-develop/svn/tests/phpunit/tests/pluggable.php:20
5) Tests_Pluggable::testAllPluggableFunctionsExist
Function: wp_cache_reset()
Failed asserting that false is true.
/srv/www/wp-develop/svn/tests/phpunit/tests/pluggable.php:64
6) Tests_Term_Meta::test_term_meta_should_be_lazy_loaded_for_all_terms_in_wp_query_loop
Failed asserting that 116548 is identical to 116546.
/srv/www/wp-develop/svn/tests/phpunit/tests/term/meta.php:139
7) Tests_Term_Meta::test_term_meta_should_be_lazy_loaded_only_for_the_queries_in_which_the_term_has_posts
Failed asserting that 116711 is identical to 116712.
/srv/www/wp-develop/svn/tests/phpunit/tests/term/meta.php:183
#21
follow-up:
↓ 23
@
10 years ago
@johnbillion What do you think about skipping the pluggable function signatures checks for cache functions when wp_using_ext_object_cache()?
#23
in reply to:
↑ 21
@
10 years ago
Replying to ocean90:
@johnbillion What do you think about skipping the pluggable function signatures checks for cache functions when
wp_using_ext_object_cache()?
That makes sense. Core doesn't have control over the parameter names in the pluggable functions that cache drop-ins implement. Although it does highlight the fact that the wp_cache_get() function in the Memcached plugin is missing its fourth parameter.
#27
@
10 years ago
Current status: https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/85191633 ¯\_(ツ)_/¯
#29
@
10 years ago
$ phpunit -c tests/phpunit/multisite.xml // … 2171) Tests_XMLRPC_wp_uploadFile::test_valid_attachment Undefined property: stdClass::$domain /srv/www/wp-develop/svn/tests/phpunit/includes/factory.php:190 /srv/www/wp-develop/svn/tests/phpunit/includes/factory.php:59 /srv/www/wp-develop/svn/tests/phpunit/includes/testcase.php:85 /srv/www/wp-develop/svn/tests/phpunit/includes/testcase-xmlrpc.php:10 /usr/local/src/composer/vendor/phpunit/phpunit/phpunit:56 FAILURES! Tests: 4875, Assertions: 7913, Errors: 2171, Skipped: 15.
#33
@
10 years ago
@ocean90 I was just made aware that this happened! Awesome stuff.
I would recommend using this as the link for the object-cache.php file: https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/584392b56dc4adbe52bd2c7b86f875e23a3e5f75/object-cache.php. When I merge develop back to master, the location of the object-cache.php file will change. The URL I provided will be more reliable longer term.
Yes please!
We should be able to just use PHP 5.6 with https://plugins.svn.wordpress.org/memcached/trunk/object-cache.php placed in the right place, plus
echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.inias suggested by http://docs.travis-ci.com/user/languages/php/#Preinstalled-PHP-extensions.