Features from the xrg dungeons

This series of articles aims to guide you through a set of pending features for OpenERP. Some of them are experimental, some more mature, some need to contain their maturing process... (read more)

Sunday, February 20, 2011

The B-Q-I tool (script)

Full-name: base_quality_interrogation.py
Status: mature
Commit: many
Branch: buildbot/bbot-v2.5
Conceived: May 2010, based on older script

Little can be said about this tool in a short blog. The history is that it started as a script that would launch one openerp-server, install a few modules and allow somehow the results to be examined.

Since then, much have changed. The b-q-i script will now launch the server in a well-controlled manner, observe and 'tee' its logs, parse the log lines with regular expressions and be able to perform various low-level RPC calls to the server (all through simple XML-RPC, so far).

The purpose: a developer can use this tool to have a repeatable procedure of launching, testing and debugging an openerp-server. Save time by not restarting a Gtk client all the time, automate some trivial tasks like creation of a database, installation of modules etc.

Two important design principles of the script are:
1. It does NOT require a special version of the server, nor does it depend on the server branch. It currently works for v.6.0.x, v6.1.x and pg-84 servers.
2. It is one file. No strange dependencies, almost no installation required.

A session in action:


[panos@.. openerp (xrg-60)]$ bqi.py -s pg84-extra -D cache.enable=False -- start-server inter
Read config from /home/panos/.openerp-bqirc
start of script
set num_modules 0
will run: python /home/panos/build/openerp/server/bin/openerp-server.py --addons-path=/home/panos/build/op
enerp/addons, ~/build/openerp/extra-addons, ~/build/openerp/sandbox/addons --log-level=test --httpd-interf
ace=127.0.0.1 --httpd-port=8169 --no-httpds -Dtests.nonfatal=True -Dftp.port=8923 -Dcache.enable=False --n
o-netrpc

server running at pid: 9615
[2011-02-20 17:49:30] INFO:server:OpenERP version - 6.0.1
[2011-02-20 17:49:30] INFO:server:addons_path - /home/panos/build/openerp/addons,/home/panos/build/openerp
/extra-addons,/home/panos/build/openerp/sandbox/addons

[2011-02-20 17:49:30] INFO:server:database hostname - localhost
[2011-02-20 17:49:30] INFO:server:database port - 5432
[2011-02-20 17:49:30] INFO:server:database user - panos
[2011-02-20 17:49:30] INFO:objects:initialising distributed objects services
Server listens HTTP at 127.0.0.1:8169
[2011-02-20 17:49:31] INFO:web-services:starting HTTP service at 127.0.0.1 port 8169
[2011-02-20 17:49:31] INFO:web-services:Registered XML-RPC over HTTP
[2011-02-20 17:49:31] INFO:web-services:Registered XML-RPC 2.0 over HTTP
[2011-02-20 17:49:31] INFO:server:Starting 1 services
Server is ready!
[2011-02-20 17:49:31] INFO:web-services:the server is running, waiting for connections...
Server started at: User: 1.330, Sys: 0.160
[2011-02-20 17:49:31] INFO:pooler:Starting pooler of database: test_bqi
[2011-02-20 17:49:31] INFO:init:Successfully loaded all 1 modules
...

[2011-02-20 17:49:36] INFO:init:module sale_analytic_plans: registering objects
[2011-02-20 17:49:36] INFO:init:module base_module_import: no quality certificate
[2011-02-20 17:49:36] WARNING:init:module web_uservoice: description is empty !
[2011-02-20 17:49:36] INFO:init:module base_vat: no quality certificate
[2011-02-20 17:49:36] INFO:init:module account_greek_fiscal: no quality certificate
[2011-02-20 17:49:36] INFO:init:module association: no quality certificate
[2011-02-20 17:49:36] INFO:init:module project_planning: no quality certificate
[2011-02-20 17:49:37] INFO:pooler:Successfuly loaded database "test_bqi"
Interactive mode. Enjoy!
Remember, the 'admin' password is "admin" and the super-user "admin"
[2011-02-20 17:49:37] INFO :web-services:successful login from 'admin' using database 'test_bqi'
BQI> import -t -m stock addons/stock/test/stock_test_dim2.yml
Trying to import ~/addons/stock/test/stock_test_dim2.yml as yaml for stock in test mode  
[2011-02-20 17:49:41] INFO:web-services:successful login from 'admin' using database 'test_bqi'
set context stock.test
[2011-02-20 17:49:41] TEST:tests.stock:In Order to test the picking I create picking with move lines.
[2011-02-20 17:49:47] TEST:tests.stock:I click on draft_force_assign on picking.
[2011-02-20 17:49:49] TEST:tests.stock:I click on force_assign on picking.
[2011-02-20 17:49:49] TEST:tests.stock:I confirm the picking.
[2011-02-20 17:49:50] TEST:tests.stock:  - will be using ir.actions.act_window action action_partial_picking #658
[2011-02-20 17:49:50] TEST:tests.stock:  - it is an ir.actions.act_window action at loop #1

[2011-02-20 17:49:50] TEST:tests.stock:  - will emulate a form view: stock.partial.picking#?
[2011-02-20 17:49:50] TEST:tests.stock:  - in the "Process Picking" form, I will press the "_Validate" button.
[2011-02-20 17:50:20] TEST:tests.stock:  - it is an ir.actions.act_window_close action at loop #2
[2011-02-20 17:50:20] TEST:tests.stock:  - closing window gracefully
Assertions report:
Level   success failure 
30      3       0 
total   3       0 
end of report (3 assertion(s) checked) 
Data file imported at: User: 8.540, Sys: 0.600, Real: 38.340
clear context
[2011-02-20 17:50:20] INFO:modules:Successfuly imported yaml: stock.stock_location_customers,stock_picking
_0,product.product_product_pc1,base.main_company,product.product_uom_unit,stock.stock_location_stock,base.

res_partner_address_4,stock.menu_action_picking_tree6

BQI>  
Server ending at: User: 12.940, Sys: 0.940
Terminating..
Waiting the server to terminate for 5 sec..
[2011-02-20 17:50:24] INFO:server:Signal received, trying to shutdown: SIGTERM
[2011-02-20 17:50:24] INFO:server:Shutting down Server!
[2011-02-20 17:50:24] INFO:server:Stopping 2 services
Finished server with: 0
Terminated.
[panos@.. openerp (xrg-60)]$

2 comments:

  1. Hi,

    I get your bqi script included with openerp-buildbot from launchpad, but it always gives "cannot marshal None unless allow_none is enabled" xmlrpc error.

    Could you give some hints on how to get started with bqi?

    thx

    ReplyDelete
  2. I think that bug existed in some early versions. It should be fixed in the 'bbot-v2.6' branch in LP.

    However, you shall prefer the latest B-Q-I (with all features) from the git branch at:
    http://git.hellug.gr/?p=xrg/openerp-buildbot;a=shortlog;h=refs/heads/bbot-v3

    ReplyDelete