lag/colonel-smoker-bundle
Composer 安装命令:
composer require lag/colonel-smoker-bundle
包简介
The Colonel helps you to check the smoke in your application
README 文档
README
The Colonel Smoker is an expert in smoke. He can even tell if your application is smoking before deploying it to production.
The Colonel Smoker find the URLs of your Symfony application (only Symfony is supported now) and looks for 500 errors.
Main features :
- helps providing requirements parameters for your dynamic URLs
- uses the routes declared in the Symfony routing by default
- check for response code
- check if the resulted html contains dynamic data from your entity
The goal is to ensure that each urls in your application does not contains critical errors. It is especially designed for application which have pages with complex and dynamic data to display.
This bundle relies on Symfony service injection. If your are not familiar with this, you can read documentation here
Installation
composer require --dev lag/colonel-smoker-bundle
Configuration
# config/packages/test/lag_smoker.yaml lag_smoker: host: 'http://127.0.0.1:8000/' # This is the default configuration # This route will be used to generated urls to test against routes: # The homepage route has no parameters and expect a 200 OK response code app.homepage: ~ # The show article requires parameters. They will be provided by the mapping "article" app.show_article: mapping: article # The mapping will be used to generated urls with dynamic parameters mapping: # This name can be anything, but it has to be unique article: # This mapping will be used with the Article entity of your application entity: App\JK\CmsBundle\Entity\Article # The property id in the route parameters (/articles/{id} for example) will be mapped with id property of your entity requirements: id: id
Usage
- First generate the URL cache :
bin/console smoker:generate-cache
- Then run the smoke tests :
bin/console smoker:smoke
If you use the Symfony WebServer bundle, dont forget to run
bin/console server:start --env=test.
How it works
The Colonel Smoker will read the configuration and use the Symfony routing to build the urls of your application. Urls are stored in a cache. Then he calls each urls and analyze the response to find 500 errors. But it can tests more like if the html contains some static or dynamic values.
For example, if your application handles articles, the Colonel Smoker can check if the page displaying the article contains the article title.
Documentation
Reference Configuration
lag_smoker: routes: app.homepage: mapping: null provider: symfony handlers: response_code: 200 app.show_articles_redirection: mapping: article provider: my_custom_requirements_provider handlers: response_code: 302 mapping: article: entity: App\JK\CmsBundle\Entity\Article provider: symfony pattern: 'app.article_' excludes: - app.article.excluded_routes requirements: id: id categorySlug: category.slug
The Colonel relies on the Symfony DomCrawler component and the Goutte client.
Known Issues
In dev environment, we call the Symfony Client to many times when having the server on the same machine (when using the Symfony web server for example), the cache miss to retrieve value and throws an exception. It causes some build failures. A patch is in progress to avoid this.
## Road map
- Add an option to set a timeout in tests to avoid error with the cache
- Add a check to see if the web server is running
lag/colonel-smoker-bundle 适用场景与选型建议
lag/colonel-smoker-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.28k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lag/colonel-smoker-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lag/colonel-smoker-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-20