Reset and restore the test database without starting client processes

Aperta
#386 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
mysql, php
Ambito
database, testing

Direzione di ricerca

Inspect the framework's database setup code that invokes the mysql client per scenario, likely in the Behat test bootstrap. Read #384 to capture baseline CI timings before changing anything. Done means a single persistent connection handles drop/create/restore per suite and the drafted PR shows reduced times recorded in this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

scope:testing

The framework runs its own database bookkeeping through a new mysql client process each time. Per scenario that means a connection test and a DROP DATABASE before it starts. Scenarios that install WordPress add a CREATE DATABASE and an import of the cached install dump. Each client process costs about 25 ms before it does any work, and the import costs about 260 ms.

Steps:

  1. Test the database connection once per suite instead of once per scenario.
  2. Run the drop and create statements over a single persistent connection from the Behat process.
  3. Restore the cached install over that same connection.

Locally this brought a trivial query from 28 ms to 0.2 ms, and the import from 258 to 191 ms on a regular database (79 to 15 ms on an in-memory one). The database ends up in the same state as before.

Measuring: take the baseline from #384, then open a draft PR, run the same CI jobs against it and record both results here before we decide.

Lingua principale
PHP
Stelle
42
Fork
29
Merge medio
21h 6m
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wp-cli/wp-cli-tests

Tutte le issue di wp-cli/wp-cli-tests

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.