Reset and restore the test database without starting client processes

Aberta
#386 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
55/100
Tipo de issue
Refatoração
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
mysql, php
Domínio
database, testing

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
PHP
Estrelas
42
Forks
29
Merge médio
21h 6min
PRs com merge (30d)
24

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de wp-cli/wp-cli-tests

Todas as issues de wp-cli/wp-cli-tests

Issues semelhantes

Mais issues de PHP

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.