MakeBusy core is the framework for the functional test suite for Kazoo
PHP Shell Perl
Latest commit e689173 Feb 17, 2017 @jamhed jamhed sanity check
Permalink
Failed to load latest commit information.
bin multiple changes Jan 30, 2017
ci ci: add couchdb and rabbitmq logs Feb 13, 2017
doc doc: update readme and howto Jan 31, 2017
docker sanity check Feb 17, 2017
etc docs: not used config section removed Jan 23, 2017
prompts initial commit Nov 14, 2016
src/MakeBusy shortcuts and printer with function name Feb 14, 2017
tests
vendor initial commit Nov 14, 2016
.gitignore ignore sounds folder Dec 20, 2016
CONTRIBUTING.md
README.md ci: HUPALL env variable Jan 31, 2017
TODO.md Multiple updates (#11) Jan 23, 2017
composer
composer.json initial commit Nov 14, 2016
gateways.php ci: gateways fix Jan 26, 2017
php.ini ci: custom logging Jan 27, 2017
phplint initial commit Nov 14, 2016
run-suite
run-test ci: custom logging Jan 27, 2017
webhook.php initial commit Nov 14, 2016

README.md

MakeBusy

About

MakeBusy is a functional test suite for Kazoo. It works by creating test accounts in specified Kazoo cluster using Kazoo HTTP REST API and performing test calls to Kazoo cluster with separate automated FreeSWITCH instances. Kazoo entities are used to store arbitrary information required for testing and generation of FreeSWITCH configuration.

Components

To run tests you'll requite one MakeBusy instance serving XML configs for automated FreeSWITCH instances via HTTP, and at least 3 FreeSWITCH instances (to act as device, carrier and pbx substitutes).

FreeSWITCH drones

FreeSWITCH drone instances acting as device, carrier or external pbx are automated by providing generated XML configs for SIP gateways, and by issuing commands to FreeSWITCH control socket (port 8021 usually). Therefore FreeSWITCH and MakeBusy instances must be visible to each other (tcp port 8021 and 80), and, in addition, FreeSWITCH instances must have SIP and RTP access to Kazoo cluster, and MakeBusy must have access to Kazoo REST HTTP API.

Docker images

MakeBusy comprises of 4 Docker images: makebusy, makebusy-fs-auth, makebusy-fs-pbx and makebusy-fs-carrier, where makebusy-fs-* are automated FreeSWITCH images (what, in turn, are based on kazoo/freeswitch docker image). Please see Docker HOWTO.

How to write tests

Please see a brief (but yet complete) HOWTO.

How to run tests

File structure

Tests are supposed to reside in tests/KazooTests/Applications folder, grouped by Kazoo application (like Callflow) they rely on. Each test file is supposed to test one exact feature.

TestCase setup and caching

All test cases must descend from TestCase class. Each test case defines common setup for number of tests. This common setup may or may not include several Kazoo entities, such as Devices, Carriers, Callflows, Voicemails and so on. MakeBusy tries hard to reuse Kazoo entities by caching (as it takes time to create them). It is possible to disable caching by setting environment variable CLEAN, see below.

Environemt variables

Don't cache Kazoo entities:

CLEAN=1 ./run-test path_to_test.php

Hang up all drone channels before running test:

HUPALL=1 ./run-test path_to_test.php

Restart existing FreeSWITCH sofia profile before running test:

RESTART_PROFILE=1 ./run-test path_to_test.php

Skip gateway registration:

SKIP_REGISTER=1 ./run-test path_to_test.php

Skip test account creation:

SKIP_ACCOUNT=1 ./run-test path_to_test.php

Dump FreeSwitch events content to MakeBusy log file:

LOG_EVENTS=1 ./run-test path_to_test.php

Dump HTTP REST API content:

LOG_ENTITIES=1 ./run-test path_to_test.php

Log debug messages to console:

LOG_CONSOLE=1 ./run-test path_to_test.php

Display stack trace on test error/failure:

STACK_TRACE=1 ./run-test path_to_test.php

Override config.json values to connect to Kazoo:

KAZOO_URI="user password realm uri" ./run-test path_to_test.php

Intended workflow

  1. Define and name test case
  2. Define and name test
  3. Do LOG_CONSOLE=1 ./run-test path_to_test.php, and see what's going on
  4. Ensure newly defined test can run successfuly in sequential calls and it cleanups after itself
  5. Ensure newly defined test can run successfuly in freshly created environment: CLEAN=1 LOG_CONSOLE=1 ./run-test path_to_test.php
  6. Have a cup of coffee, go to 2. or 1.

Configuration file

A valid configuration file config.json must exist in MakeBusy root folder (see etc/config.json as example).

ASCII art

           `                                                                        
           .'.``                                                                    
           ,...`                                                                    
           .'...`         ``                                                        
            ;,@#.       ;;'';:`                                                     
            `,,#,`     ;;,,,:;:.`                                                   
             ',,+.   `';::  ;:':`                                                   
             `::+,` ,;:,,; : ,,':.                                                  
              +.+'.;;,:` ::` ,,,;,.`                                                
             ..:'+;'`:..,:,;:,,,,;:.                                                
              :,'';`,: ;.. .,,,,,,;:.                                               
               ,':``:,:,;`:.,.:,,.,;:`                                              
              ;',:`:,,. ,,.: :`,,,,,',`                                             
             ';::.`:,.`::,,.; ,,:,,:,;.`                                            
            ;:,:: ;,.,;,`:.:`:; `,:..::`                                            
           `;,: ;:`.`.,,.,`;.,;``::.,,;,`                                           
           .:,: .:;`:.,:```,:,` ,``:`,,:.                                           
           +;,:`  :,.:`:;:,`,:,..:`;:,,:,`                                          
           #;:::';,,:  `,, ,`;:,``;: ,,,:,`                                         
           #,':,,,,,`' ;::' ;, :,:;,`,.,:,.                                         
           `;,',,,,,: :.,`,,`.. ,,  `:,,:;,`                                        
            +,,;,::.:,`;`,,:'..,`,,.:,,::;#.                                        
            `#,.',,,,,: ,; .,;, :`:,,,,:;;,,`                                       
           ` .+:.'::`:::,., :,:: :.,:,:;;;,;.                                       
              ;::,;,:.,::` ;,.:,;,.::;:;;;;'.                                       
               +:,,;,,,.::,.' :,:,#.;:;;;;#::`                                      
               `#:,,;:,:`,: .`:,::,;;;;;##+::.                                      
                `#:::;::,,,;..,,,,:;;;'#+#'';,                                      
                 `#:::,',:,.,,,,,;;;;++#@'+;;:`                                     
                  .#;;:,';:,,:::;:;;+++#+;+++;.                                     
                   .+'::::;;;;;::;:+++#+'''':',`                                    
                   ``++::::;:.,:::++++++';';';'.                                    
                     `;+;:;;;::,:'+###++;;.+'':'`                                   
                      `:+';;;;::.,+,:+++:,:,#''',`                                  
                       `.++;;;;;':;'++'::::,.';:',`                                 
                         .:+#;;:;++'+++#,,..,,'+;;.`                                
                          `.;+#;:++++#+++.`.:,,#;;+,`                               
                            `.:#+:'+++++++.. ,,:++;'.                               
                              `.:#;'+++#++#. .,,:';''.`                             
                ,`              .,++:;++##+#,` ::;;''',`                            
                ::.               `:@:'+#+++#,:`:,;':++:`                           
                :,.                `,#:'+##+'#,, ..;';''+++`                        
                .;,`                `,#;'##'+'+,, :,;;;;;'''#`                      
                 `,.                 `,@;'+##+'+,,,,:;;;'''+'#.                     
                 ,@,`                 `:#;'+#++;+.,;''';';;;'''':`                  
                ` ::`                  `:+;'+++#'';';';+#;'''';'';`                 
                 .;''+``             `  `''+'#++'''''''';;;;''';+',                 
                '':;;;'.`           .'++''';+'#++''''';;'';''';+'''.                
                .';;:;:',`        '@.+#####+:'+#++'''''@;@;+''''''''.`              
   ,``           ';;:;;;'.`      @+######+##@'+#+++';;''+;#;;;;'''';'.              
    ..`          ';::;;';:`      :#+#'+##''++'+#+++'';'+#`'''';''';'';`             
    ::.          ';;;;';::`     '#+#+#''#'+'#'+##++'';''`@ +;;''''+#+',`            
   ``,..         ,';;';;;,`     +'+@''#;@+';:#+#'##+++''':+;''''''+#@':`            
     `.#.        `'';;;;,`       #:;#:@;#+;:+#;'##+++''+'';';'''++##+';.            
      :`:;':.     ',';;,`        #::;::#+::.'+;'##+++++''''''''++##+'+;,`           
      ``';';;;;`  :;;;,`        `;'##+#+:,`:#:+;+##++++''''''++###+'',',`           
      .#+'';'''#` `';;.          #,,,+;:,` ',,#;;###++++++'++++##++;:,+,`           
       @++';''##,` ':',           +++::,` `+:.`';'#'#+++++++++++#+;:,:#,`           
       `++'';'++:` +;',`          `.`,.`  ',,``#;'+##++++++++++++:;:::;,`           
        ++'''#';,` .';:`           ```    ;..` .+''+###++++++++#;'+;:#:.            
        `@+++##;.   ':;.                  +,.  `#;''+###++@'+++;;'#+#;:`            
         .++#';.`   ':+,                `+.,`   `#:;;'#+:;@+++,;#+++;:.             
         `@++#:`    ;;+,`               :++:`    .@:;;'+,'''';:#++++@,`             
           #'+;`    .';:`               #+#:`   ``:#:;;;;'';:::;+++++,.             
           .#;#.    `;+:`             `,#+;,`     `,#:';;':::::;+;++'++;.',.'`      
           `.#:@.`  `.+,`             `#++:.       `,#;:;,::::+#;:,:;;++''++'''#.`` 
           ``;#;#.    +,`              #+;,`         ,;#';:;+#';,.`.,;';;+;,;::;'.  
             `'+;;`   `;`             :`::.           `,'+';;;:,`    `,,,,,...'::@. 
              `##',`   :,`            '',``            `.,+',,.`      ``````#;,,.#.`
               `@#+,   `;:`          +',.`               `.+';#'.` `  `;++:...,``#.`
               `.##;`   `.+.`      `#+:,`                  `:+.`.```.``...`..```,..`
                ``,;'`   `.+`     ,@+,:,`                   `.@,````````````  ` '.. 
                  `.`..,,:;;+#'',`.+::.`                     ``#:`         ` ` @`.` 
                     ``.`...,,++#',,,.`                        .,#,           @`.`  
                            ``.,,.,.``                        ` ``,@,`       +`.`   
                               ````                               `..+#'``.#`..`    
                                                                    ``......`.`     
                                                                      ````..`