SlideShare a Scribd company logo
1 of 36
Download to read offline
AVOIDING
REGRESSIONS
Advanced techniques for testing and
updating
WordPress core
and plugins
WordCamp Copenhagen 2017
Otto Kekäläinen
Seravo.com
@ottokekalainen
● Linux and open source advocate
● Contributed to WordPress Core,
translations, Linux, Docker,
Nginx, Redis, MariaDB…
● CEO, sysadmin and developer at
Seravo.com – WordPress
hosting and upkeep
Otto Kekäläinen
Enterprise grade
hosting and upkeep
for WordPress
WHY UPDATE?
1. Security bugs
2. Other bugs
3. New features
WHY NOT TO UPDATE?
1. New security bugs
2. New other bugs
3. Old features
Example case: Mossack Fonseca aka Panama papers
● The site www.mossfon.com was running WordPress
● Unauthorized access of WP lead to unauthorized access of MS Exchange
email server on internal network and other sites at *.mossfon.com
● The intruders most likely came through an old and insecure version of the
Revolution Slider plugin.
○ Well known vulnerability, WordPress.org even has a patch as a separate plugin
(https://wordpress.org/plugins/patch-for-revolution-slider/) as Revolution Slider itself is not
available at WordPress.org.
Example case: Mossack Fonseca aka Panama papers
● Case analysis at
https://www.wordfence.com/blog/2016/04/mossack-fonseca-breach-vulner
able-slider-revolution/
WP PLUGIN REVIEW GUIDELINES FOR
CAPITALISTS*
If the logo is red and
name contains revolution,
don’t install it on your system!
* a small dose of parody can’t hurt?
You must keep your
WordPress site secure.
THE PROBLEM:
WHY AREN’T
EVERYBODY
UPDATING THEIR
WORDPRESS AND
PLUGINS?
BECAUSE
OF THIS:
UPDATES IN WORDPRESS
● WordPress core minor version updates (4.7.4 -> 4.7.5): security
● WordPress major version updates (3.9 -> 4.0, 4.6 -> 4.7): features
● WordPress plugin updates can contain anything
● There is just one WordPress.org update channel
○ No separate security updates channel like in Linux distros
● Plugins and themes from other places than WordPress.org might
have automatic update channel
○ No guarantee: worst case scenario is that there are no update
notifications and you need to do everything about updates
manually
THE PROBLEM IS THE PLUGINS.
SOLUTION:
ROLL-BACK BAD UPDATES?
YOU HAVE NIGHTLY OFF-SITE
BACKUPS, RIGHT?
FILES VS. DATABASE
Updates install new files, and they might
upgrade the data format in the database to
become backwards incompatible.
Reverting by putting the old files in place might
not work because of the database contents!
cp -ra /data/backups/wordpress /wordpress
wp db import /data/backups/db/site.sql
ROLL-BACKS IN PRODUCTION
ARE BAD
1. Downtime between bad update and
roll-back
2. Lost database contents
(WooCommerce orders, anybody?)
3. If the site broke so badly that you
could not access WP-admin, was that a
bad or actually a good thing?
INTRODUCING SHADOW UPDATES
1. Make an identical copy of the
production site (same URLs etc)
that is not visible to the public
2. Update the shadow
3. Test the shadow
4. Only if tests pass, run the same
updates in production
REGRESSION TESTING WORDPRESS
Open source tools
● RSpec – test runner
● Capybara – navigate the site virtually (headlessly)
● PhantomJS – headless browser
● GraphicsMagic – visual comparison
Tests part of our project template:
https://github.com/Seravo/wordpress/tree/master/tests/rspec
Docs: https://seravo.com/docs/tests/integration-tests/
INTERGRATION TEST EXAMPLE 1/2
before do
visit WP.siteurl('/wp-login.php')
end
it "There's a login form" do
expect(page).to have_id "wp-submit"
end
INTERGRATION TEST EXAMPLE 2/2
if WP.user?
it "Logged in to WordPress Dashboard" do
within("#loginform") do
fill_in 'log', :with => WP.user.username
fill_in 'pwd', :with => WP.user.password
end
click_button 'wp-submit'
# Should obtain cookies and be able to visit /wp-admin
expect(page).to have_id "wpadminbar"
end
end
VISUAL REGRESSION TESTS
$ gm compare -highlight-style assign
-highlight-color purple -file diff.png *.png
VISUAL REGRESSION TESTS
$ gm compare -verbose -metric mse *.png
Image Difference (MeanSquaredError):
Normalized Absolute
============ ==========
Red: 0.0319159868 8.1
Green: 0.0251841368 6.4
Blue: 0.0278537225 7.1
Opacity: 0.0000000000 0.0
Total: 0.0212384615 5.4
Where do you draw the line
between acceptable changes
and failures/regressions?
AUTOMATING UPDATES:
90 % BY ROBOTS
10 % BY HUMANS
What could WordPress
plugin nd theme developers
do to avoid regressions?
TRAVIS-CI.ORG SIMPLE EXAMPLE
https://github.com/Seravo/seravo-plugin/blob/master/.travis.yml
sudo: false
language: php
php:
- 5.6
- 7.0
- nightly
script:
- find -name '*.php' -exec php -d
error_reporting=32767 -l {} ;
TRAVIS-CI.ORG IN ACTION
TRAVIS-CI CHECKING EVERY COMMIT
..AND PULL REQUESTS!
NOTIFICATON EMAILS THAT
CAN’T GO UNNOTICED
TRAVIS-CI.ORG BIG EXAMPLE 1/3
https://github.com/Seravo/wordpress/blob/master/.travis.yml
[...]
env:
- WP_TEST_URL=http://localhost:12000 WP_TEST_USER=test WP_TEST_USER_PASS=test
DB_USER=root DB_PASSWORD='' DB_NAME=test
matrix:
allow_failures:
- php: nightly
before_install:
- rvm install 2.2.5
before_script:
# Install composer packages before trying to activate themes or plugins
- composer install
# Create database
- mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASSWORD"
TRAVIS-CI.ORG BIG EXAMPLE 2/3
https://github.com/Seravo/wordpress/blob/master/.travis.yml
before_script:
...
# Install router so that we don't need nginx/php-fpm
- curl -s
https://raw.githubusercontent.com/Seravo/wordpress-test-template/master/lib/router.ph
p > htdocs/router.php
# Start php server on background
- cd htdocs && php -S 0.0.0.0:12000 router.php &
# Install WordPress with wp-cli
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- php wp-cli.phar core install --url=$WP_TEST_URL --title='Test'
--admin_user=$WP_TEST_USER --admin_password=$WP_TEST_USER_PASS
--admin_email="$WP_TEST_USER@wordpress.dev" --path=htdocs/wordpress
TRAVIS-CI.ORG BIG EXAMPLE 3/3
https://github.com/Seravo/wordpress/blob/master/.travis.yml
# Activate all plugins
- php wp-cli.phar plugin activate --all --path=htdocs/wordpress
# test webserver
- curl -i http://localhost:12000
# Install packages for gulp
- npm install
# Test gulp and compile assets
- gulp
# Install gems for rspec tests
- gem install bundler
- bundle install --gemfile=tests/rspec/Gemfile
script:
- cd tests/rspec && bundle exec rspec *.rb
My META contributions tomorrow?
● Increased git use at WordPress.org
● Plugin CI and QA infra for WordPress.org
Any core devs around tomorrow?
TAK FOR
JERES
TID! SERAVO.COM
facebook.com/Seravocom
Twitter: @Seravo @ottokekalainen

More Related Content

More from Otto Kekäläinen

The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themOtto Kekäläinen
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressOtto Kekäläinen
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesAutomatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesOtto Kekäläinen
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...Otto Kekäläinen
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsAutomatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsOtto Kekäläinen
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Otto Kekäläinen
 
WordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetWordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetOtto Kekäläinen
 
Technical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionTechnical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionOtto Kekäläinen
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
 
MariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsMariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsOtto Kekäläinen
 
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017Otto Kekäläinen
 
WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017Otto Kekäläinen
 
Find WordPress performance bottlenecks with XDebug PHP profiling
Find WordPress performance bottlenecks with XDebug PHP profilingFind WordPress performance bottlenecks with XDebug PHP profiling
Find WordPress performance bottlenecks with XDebug PHP profilingOtto Kekäläinen
 
Testing and updating WordPress - Advanced techniques for avoiding regressions
Testing and updating WordPress - Advanced techniques for avoiding regressionsTesting and updating WordPress - Advanced techniques for avoiding regressions
Testing and updating WordPress - Advanced techniques for avoiding regressionsOtto Kekäläinen
 
MariaDB Developers Meetup 2016 welcome words
MariaDB Developers Meetup 2016 welcome wordsMariaDB Developers Meetup 2016 welcome words
MariaDB Developers Meetup 2016 welcome wordsOtto Kekäläinen
 
MariaDB in Debian and Ubuntu: The next million users
MariaDB in Debian and Ubuntu: The next million usersMariaDB in Debian and Ubuntu: The next million users
MariaDB in Debian and Ubuntu: The next million usersOtto Kekäläinen
 
Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016Otto Kekäläinen
 
MariaDB Foundation presentation and membership info
MariaDB Foundation presentation and membership infoMariaDB Foundation presentation and membership info
MariaDB Foundation presentation and membership infoOtto Kekäläinen
 

More from Otto Kekäläinen (20)

The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix them
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPress
 
Technical SEO for WordPress
Technical SEO for WordPressTechnical SEO for WordPress
Technical SEO for WordPress
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesAutomatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themes
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsAutomatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress plugins
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)
 
WordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetWordPress-tietoturvan perusteet
WordPress-tietoturvan perusteet
 
Technical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionTechnical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 edition
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
MariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsMariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environments
 
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
 
WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017
 
Find WordPress performance bottlenecks with XDebug PHP profiling
Find WordPress performance bottlenecks with XDebug PHP profilingFind WordPress performance bottlenecks with XDebug PHP profiling
Find WordPress performance bottlenecks with XDebug PHP profiling
 
Testing and updating WordPress - Advanced techniques for avoiding regressions
Testing and updating WordPress - Advanced techniques for avoiding regressionsTesting and updating WordPress - Advanced techniques for avoiding regressions
Testing and updating WordPress - Advanced techniques for avoiding regressions
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
MariaDB Developers Meetup 2016 welcome words
MariaDB Developers Meetup 2016 welcome wordsMariaDB Developers Meetup 2016 welcome words
MariaDB Developers Meetup 2016 welcome words
 
MariaDB in Debian and Ubuntu: The next million users
MariaDB in Debian and Ubuntu: The next million usersMariaDB in Debian and Ubuntu: The next million users
MariaDB in Debian and Ubuntu: The next million users
 
Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016
 
MariaDB Foundation presentation and membership info
MariaDB Foundation presentation and membership infoMariaDB Foundation presentation and membership info
MariaDB Foundation presentation and membership info
 

Recently uploaded

All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 

Testing and updating WordPress (WordCamp Copenhagen 2017)

  • 1. AVOIDING REGRESSIONS Advanced techniques for testing and updating WordPress core and plugins WordCamp Copenhagen 2017 Otto Kekäläinen Seravo.com @ottokekalainen
  • 2. ● Linux and open source advocate ● Contributed to WordPress Core, translations, Linux, Docker, Nginx, Redis, MariaDB… ● CEO, sysadmin and developer at Seravo.com – WordPress hosting and upkeep Otto Kekäläinen
  • 3. Enterprise grade hosting and upkeep for WordPress
  • 4. WHY UPDATE? 1. Security bugs 2. Other bugs 3. New features
  • 5. WHY NOT TO UPDATE? 1. New security bugs 2. New other bugs 3. Old features
  • 6. Example case: Mossack Fonseca aka Panama papers ● The site www.mossfon.com was running WordPress ● Unauthorized access of WP lead to unauthorized access of MS Exchange email server on internal network and other sites at *.mossfon.com ● The intruders most likely came through an old and insecure version of the Revolution Slider plugin. ○ Well known vulnerability, WordPress.org even has a patch as a separate plugin (https://wordpress.org/plugins/patch-for-revolution-slider/) as Revolution Slider itself is not available at WordPress.org.
  • 7. Example case: Mossack Fonseca aka Panama papers ● Case analysis at https://www.wordfence.com/blog/2016/04/mossack-fonseca-breach-vulner able-slider-revolution/
  • 8. WP PLUGIN REVIEW GUIDELINES FOR CAPITALISTS* If the logo is red and name contains revolution, don’t install it on your system! * a small dose of parody can’t hurt?
  • 9. You must keep your WordPress site secure.
  • 10. THE PROBLEM: WHY AREN’T EVERYBODY UPDATING THEIR WORDPRESS AND PLUGINS?
  • 12. UPDATES IN WORDPRESS ● WordPress core minor version updates (4.7.4 -> 4.7.5): security ● WordPress major version updates (3.9 -> 4.0, 4.6 -> 4.7): features ● WordPress plugin updates can contain anything ● There is just one WordPress.org update channel ○ No separate security updates channel like in Linux distros ● Plugins and themes from other places than WordPress.org might have automatic update channel ○ No guarantee: worst case scenario is that there are no update notifications and you need to do everything about updates manually
  • 13. THE PROBLEM IS THE PLUGINS.
  • 15. YOU HAVE NIGHTLY OFF-SITE BACKUPS, RIGHT?
  • 16. FILES VS. DATABASE Updates install new files, and they might upgrade the data format in the database to become backwards incompatible. Reverting by putting the old files in place might not work because of the database contents! cp -ra /data/backups/wordpress /wordpress wp db import /data/backups/db/site.sql
  • 17. ROLL-BACKS IN PRODUCTION ARE BAD 1. Downtime between bad update and roll-back 2. Lost database contents (WooCommerce orders, anybody?) 3. If the site broke so badly that you could not access WP-admin, was that a bad or actually a good thing?
  • 18. INTRODUCING SHADOW UPDATES 1. Make an identical copy of the production site (same URLs etc) that is not visible to the public 2. Update the shadow 3. Test the shadow 4. Only if tests pass, run the same updates in production
  • 19. REGRESSION TESTING WORDPRESS Open source tools ● RSpec – test runner ● Capybara – navigate the site virtually (headlessly) ● PhantomJS – headless browser ● GraphicsMagic – visual comparison Tests part of our project template: https://github.com/Seravo/wordpress/tree/master/tests/rspec Docs: https://seravo.com/docs/tests/integration-tests/
  • 20. INTERGRATION TEST EXAMPLE 1/2 before do visit WP.siteurl('/wp-login.php') end it "There's a login form" do expect(page).to have_id "wp-submit" end
  • 21. INTERGRATION TEST EXAMPLE 2/2 if WP.user? it "Logged in to WordPress Dashboard" do within("#loginform") do fill_in 'log', :with => WP.user.username fill_in 'pwd', :with => WP.user.password end click_button 'wp-submit' # Should obtain cookies and be able to visit /wp-admin expect(page).to have_id "wpadminbar" end end
  • 22. VISUAL REGRESSION TESTS $ gm compare -highlight-style assign -highlight-color purple -file diff.png *.png
  • 23. VISUAL REGRESSION TESTS $ gm compare -verbose -metric mse *.png Image Difference (MeanSquaredError): Normalized Absolute ============ ========== Red: 0.0319159868 8.1 Green: 0.0251841368 6.4 Blue: 0.0278537225 7.1 Opacity: 0.0000000000 0.0 Total: 0.0212384615 5.4
  • 24. Where do you draw the line between acceptable changes and failures/regressions?
  • 25. AUTOMATING UPDATES: 90 % BY ROBOTS 10 % BY HUMANS
  • 26. What could WordPress plugin nd theme developers do to avoid regressions?
  • 27. TRAVIS-CI.ORG SIMPLE EXAMPLE https://github.com/Seravo/seravo-plugin/blob/master/.travis.yml sudo: false language: php php: - 5.6 - 7.0 - nightly script: - find -name '*.php' -exec php -d error_reporting=32767 -l {} ;
  • 32. TRAVIS-CI.ORG BIG EXAMPLE 1/3 https://github.com/Seravo/wordpress/blob/master/.travis.yml [...] env: - WP_TEST_URL=http://localhost:12000 WP_TEST_USER=test WP_TEST_USER_PASS=test DB_USER=root DB_PASSWORD='' DB_NAME=test matrix: allow_failures: - php: nightly before_install: - rvm install 2.2.5 before_script: # Install composer packages before trying to activate themes or plugins - composer install # Create database - mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASSWORD"
  • 33. TRAVIS-CI.ORG BIG EXAMPLE 2/3 https://github.com/Seravo/wordpress/blob/master/.travis.yml before_script: ... # Install router so that we don't need nginx/php-fpm - curl -s https://raw.githubusercontent.com/Seravo/wordpress-test-template/master/lib/router.ph p > htdocs/router.php # Start php server on background - cd htdocs && php -S 0.0.0.0:12000 router.php & # Install WordPress with wp-cli - curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar - php wp-cli.phar core install --url=$WP_TEST_URL --title='Test' --admin_user=$WP_TEST_USER --admin_password=$WP_TEST_USER_PASS --admin_email="$WP_TEST_USER@wordpress.dev" --path=htdocs/wordpress
  • 34. TRAVIS-CI.ORG BIG EXAMPLE 3/3 https://github.com/Seravo/wordpress/blob/master/.travis.yml # Activate all plugins - php wp-cli.phar plugin activate --all --path=htdocs/wordpress # test webserver - curl -i http://localhost:12000 # Install packages for gulp - npm install # Test gulp and compile assets - gulp # Install gems for rspec tests - gem install bundler - bundle install --gemfile=tests/rspec/Gemfile script: - cd tests/rspec && bundle exec rspec *.rb
  • 35. My META contributions tomorrow? ● Increased git use at WordPress.org ● Plugin CI and QA infra for WordPress.org Any core devs around tomorrow?