💨 Smoke testing tool written in PHP

Overview

Cigar

Build Status Coverage Status SensioLabsInsight

A smoke testing tool inspired by symm/vape

Similar tools include:

Installation

Install via composer:

composer require brunty/cigar --dev

Pull via docker:

docker pull brunty/cigar

To use

Create a .cigar.json file that contains an array of json objects specifying the url, status, (optional) content, and (optional) content-type to check.

[
  {
    "url": "http://httpbin.org/status/418",
    "status": 418,
    "content": "teapot"
  },
  {
    "url": "http://httpbin.org/status/200",
    "status": 200,
    "content-type": "text/html"
  },
  {
    "url": "http://httpbin.org/status/304",
    "status": 304
  },
  {
    "url": "http://httpbin.org/status/500",
    "status": 500
  }
]

When installed via composer:

Run vendor/bin/cigar to have it check each of the URLs return the status code expected.

When pulled via docker:

Run docker run -v $(pwd):/app --rm brunty/cigar to have it check each of the URLs return the status code expected.

> vendor/bin/cigar                                           
✓ http://httpbin.org/status/418 [418:418] teapot
✓ http://httpbin.org/status/200 [200:200] [text/html:text/html] 
✓ http://httpbin.org/status/304 [304:304] 
✓ http://httpbin.org/status/500 [500:500] 

The format of the lines in the output is:

pass/fail url [expected_code:actual_code] [optional_expected_content-type:optional_actual_content-type] optional_text

If all tests pass, the return code $? will be 0 - if any of them don't return the expected status code, the return code will be 1

Quiet test mode

If you wish to suppress the output of the test run, pass the --quiet option to the command: vendor/bin/cigar --quiet

Alternative configuration files

If you wish to use an alternative configuration file, use the vendor/bin/cigar -c file.json or vendor/bin/cigar --config=file.json options when running the command.

Passing a base URL to check against

If you wish to check a file of URLs relative to the root of a site against a base URL, you can do so with by using vendor/bin/cigar -u http://httpbin.org or vendor/bin/cigar --url=http://httpbin.org

Your configuration file can then contain URLs including:

  • Full absolute URLs as before (cigar won't use the base URL when checking an absolute URL)
[
  {
    "url": "http://httpbin.org/status/418",
    "status": 418,
    "content": "teapot"
  }
]
  • URLs relative to the base url that you've specified, either with or without a leading slash.
[
 {
   "url": "/status/418",
   "status": 418,
   "content": "teapot"
 },
 
 {
   "url": "status/418",
   "status": 418,
   "content": "teapot"
 }
]

Disabling SSL cert verification

If you wish to run the tool without checking SSL certs, use the -i or --insecure option to the command: vendor/bin/cigar -i or vendor/bin/cigar --insecure

Only use this if absolutely necessary.

Passing Authorization header

If you wish to add the Authorization header, use the -a or --auth option to the command: vendor/bin/cigar -a "Basic dXNyOnBzd2Q=" or vendor/bin/cigar --auth="Basic dXNyOnBzd2Q="

Passing custom header

If you wish to add any custom header(s), use the -h or --header option to the command: vendor/bin/cigar -h "Cache-control: no-cache" or vendor/bin/cigar --header="Cache-control: no-cache"

Command help & command version

If you want to see all the available options for Cigar, use the command: vendor/bin/cigar --help

If you wish to see what version of Cigar you're using, use the command: vendor/bin/cigar --version

Contributing

This started as a small personal project.

Although this project is small, openness and inclusivity are taken seriously. To that end a code of conduct (listed in the contributing guide) has been adopted.

Contributor Guide

Comments
  • Adding timeout options both CLI and .cigar.json

    Adding timeout options both CLI and .cigar.json

    🎆🎆🎆 Happy New Year 🎆🎆🎆

    This PR adds the timeout options discussed in #31 Closes / implements #31

    Any values in the CLI are overridden by what ever value is in the .cigar.json

    enhancement easy pickings 
    opened by WyriHaximus 9
  • JSON output

    JSON output

    I'm toying with the idea to run cigar against production as an extra safe guard the application is still functioning as it should. Are you open to a JSON output writer?

    opened by WyriHaximus 4
  • Support for PHP 7.0?

    Support for PHP 7.0?

    We currently still have projects which use PHP 7.0 so I wonder if you would be willing to support that PHP version too.

    I am aware that PHP 7.0 is EOL at the end of this year but sometimes the choice is not ours. I'd still love to integrate cigar in these projects however.

    opened by mbrodala 4
  • Pass base URL as CLI argument

    Pass base URL as CLI argument

    Similar to https://github.com/symm/vape it should be possible to pass the base URL for smoke tests as CLI argument instead of hardcoding it in the .cigar.json.

    This is essential for running the same batch of checks against multiple environments of the same project, e.g. staging and production.

    Currently one can work around this with multiple files named after the environments and passing them to the CLI accordingly but this can quickly become a hassle to manage, especially if the files are not properly kept in sync.

    enhancement 
    opened by mbrodala 4
  • Use a proper console tool?

    Use a proper console tool?

    Not sure if it's needed to use something like symfony/console etc - it feels like an unnecessary dependency, despite the niceness for options / output etc.

    Cigar is a basic tool and I'm not sure it needs it.

    opened by Brunty 4
  • Require the curl extension in composer.json

    Require the curl extension in composer.json

    By requiring the curl extension at the installation step users don't get unwanted errors when the curl extension is missing (which is highly unlikely) and they try to use cigar.

    bug enhancement easy pickings 
    opened by WyriHaximus 2
  • Link to blackfireio/player

    Link to blackfireio/player

    It's a good practice to link to similar tools in a README file. Can you add this one? It seems it can do same as cigar. https://github.com/blackfireio/player

    opened by ostrolucky 2
  • Allow to ignore incorrect SSL certificate

    Allow to ignore incorrect SSL certificate

    In some cases it is required to ignore an "incorrect" SSL certificate. For example a self-signed certificate.

    This can be done by disabling peer verification: https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html

    curl_setopt($channel, CURLOPT_SSL_VERIFYPEER, 0);
    

    It seems that currently this kind of "overall" configuration is not supported? I could imagine a similar feature request for support of HTTP Basic Authentication...

    opened by holtkamp 1
  • Add test for connect timeout

    Add test for connect timeout

    Follow up of https://github.com/Brunty/cigar/pull/32#discussion_r245058697, adding such test would require a host that can wait X seconds before accepting the connection

    opened by WyriHaximus 0
  • Connect and response timeout support

    Connect and response timeout support

    Having both those time outs supported would be great. Running into an issue where it continues to wait for a requests that for some reason never completes

    opened by WyriHaximus 3
Releases(1.12.3)
Owner
Matt Brunt
Problem solver, techie, wizard. Trying to leave things better than I found them.
Matt Brunt
YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.

PHP Depend Documentation PHP Depend for enterprise Available as part of the Tidelift Subscription. The maintainers of PHP Depend and thousands of othe

PHP_Depend 837 Dec 14, 2022
Opens an interactive PHP console for running and testing PHP code.

wp-cli/shell-command Opens an interactive PHP console for running and testing PHP code. Quick links: Using | Installing | Contributing | Support Using

WP-CLI 20 Nov 4, 2022
PSpec is a testing framework for PHP, influenced by RSpec and jest. 🧪 This repo is a MIRROR of the GitLab source repository.

PSpec PSpec is a testing framework for PHP, influenced by RSpec and jest. This project is experimental and still needs a lot of work. Example // src/C

CodingPaws 0 Mar 31, 2022
Allows Admins to quickly login as any user in the system during development/testing

SilverStripe User Switcher The module adds a small form both in the frontend to quickly login as any user in the system. The intended use is in testin

LiveSource 15 Mar 1, 2021
A Laravel test build by Incline Start-up Agency. Testing Git and framework functions.

Incognito-Confessions A laravel test build by Incline Start-up Agency. Testing Git and framework functions. Description A laravel starter for future t

null 6 Nov 9, 2022
Testing utilities for the psr/log package that backs the PSR-3 specification.

FIG - Log Test Testing utilities for the psr/log package that backs the PSR-3 specification. Psr\Log\Test\LoggerInterfaceTest provides a base test cla

PHP-FIG 3 Nov 19, 2022
Testing your OpenApi documentation and your code easily.

Raven - How to test your API documentation and behavior. This library was written to allow testing OpenAPI documentation easily. It also allows verify

CH Studio 30 Dec 6, 2022
A sampling profiler for PHP written in PHP, which reads information about running PHP VM from outside of the process.

Reli Reli is a sampling profiler (or a VM state inspector) written in PHP. It can read information about running PHP script from outside of the proces

null 272 Dec 22, 2022
A sampling profiler for PHP written in PHP, which reads information about running PHP VM from outside of the process.

Reli Reli is a sampling profiler (or a VM state inspector) written in PHP. It can read information about running PHP script from outside of the proces

null 258 Sep 15, 2022
A multithreaded application server for PHP, written in PHP.

appserver.io, a PHP application server This is the main repository for the appserver.io project. What is appserver.io appserver.io is a multithreaded

appserver.io 951 Dec 25, 2022
A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch screens with a resolution of 1024x600 connected to a Raspberry Pi.

EDStatusPanel A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch scr

marcus-s 24 Oct 4, 2022
PHP generics written in PHP

PHP generics written in PHP Require PHP >= 7.4 Composer (PSR-4 Autoload) Table of contents How it works Quick start Example Features Tests How it work

Anton Sukhachev 173 Dec 30, 2022
A PHP parser written in PHP

PHP Parser This is a PHP 5.2 to PHP 8.1 parser written in PHP. Its purpose is to simplify static code analysis and manipulation. Documentation for ver

Nikita Popov 15.9k Jan 8, 2023
A beautiful, fully open-source, tunneling service - written in pure PHP

Expose A completely open-source ngrok alternative - written in pure PHP. Documentation For installation instructions, in-depth usage and deployment de

Beyond Code 3.9k Jan 7, 2023
Websocket chat room written in PHP based on workerman.

基于workerman的GatewayWorker框架开发的一款高性能支持分布式部署的聊天室系统。

walkor 1.1k Jan 8, 2023
A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms

Valeyard IRC-SQL-GateWay A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms. This bot is mo

Valerie Pond 10 Oct 6, 2022
Wake PC is a super tiny password protected webapp for linux machines that sends WOL packets, written in PHP.

Wake PC Wake PC is a super tiny password protected webapp for linux machines that sends WOL packets, written in PHP. How to set up Quick setup You can

Dániel Szabó 45 Dec 30, 2022
A GETTR.com client library written in PHP with Laravel support.

Gettr API Clinet PHP A GETTR.com client library written in PHP with Laravel support. This library uses unofficial publicly accessible API endpoints of

null 10 Dec 13, 2022