Reset and restore the test database without starting client processes

未关闭
#386 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
mysql, php
领域
database, testing

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
PHP
星标
42
派生
29
平均合并
21 小时 6 分钟
30 天内合并 PR
24

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wp-cli/wp-cli-tests 的其他 Issue

查看 wp-cli/wp-cli-tests 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。