[ZBXNEXT-686] Create infrastructure for continuous integration and unit testing Created: 2010 Dec 08  Updated: 2020 Oct 21

Status: Reopened
Project: ZABBIX FEATURE REQUESTS
Component/s: API (A), Frontend (F)
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Major
Reporter: Alexei Vladishev Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It should probably be a combination of PHPUnit, Hudson and misc code analysers. Let's see what we get at the end.



 Comments   
Comment by richlv [ 2011 Feb 28 ]

created by now

Comment by richlv [ 2011 Mar 02 ]

reopen for moving

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 04 ]

(1) We should get rid of testhelpers instead using ZbxExitException instead of exit() / die()

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 04 ]

I've implemented basic fixture-based tests in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-686

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 25 ]

Basic file-based tests and parameter handling implemented in r47620 according to spec.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 29 ]

File-based tests with complicated scenarios and Respect/Validation validation implemented in r47644.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Jul 30 ]

(2) We need to be able to validate arrays using the same validators as separate values. Something like the code below, but simpler:

response:
  __assert: count(3)
  __keys:
    __assert: sequentialKeys
    __each:
      __assert: int
  __each:
    id:
      __assert: notEmpty:int
    hostname:
      __assert: notEmpty|string|length(5,10)
    templates:
      __assert: array|length(3)
      __each:
        __assert: string|length(0,12)

A similar example with equals support:

response:
  __assert: count(3)
  __keys:
    __assert: sequentialKeys
    __each:
      __assert: int
  __each:
    id:
      __equals: 1
    hostname:
      __equals: Zabbix server
    templates:
      __equals: [100, 101, 102]

andrewtch RESOLVED in r47667. Also, a new validator has been added, 'sequence' (implementing sequentialKeys as above).
Also, I've implemented nice exceptions with paths like "Validation definition is not an array on path "_assert->_keys->_each[0]".
I've also added support of short syntax turning:

hostids:
    _each:
        _assert: int

into:

hostids:
    _each: int

in r47671.

jelisejev CLOSED.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Aug 01 ]

(3) We should NOT use direct header() call, using wrapper instead.

RESOLVED in r47747.

jelisejev CLOSED.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Aug 01 ]

(4) We should avoid all

__DIR__ . '/../../../../../.......'

constructs and make some path resolver (probably, these values should be set inside phpunit config file).

jelisejev WON'T FIX.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Aug 04 ]

(5) We should use symfony/console table helper while displaying table rows in sql assertion instead of json_encode.

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Oct 29 ]

A lot of changes to the API tests have been made, so the comments above can be ignored.

In short, branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-686 implements a framework for writing API tests.

Some changes have been made to frontend API client. It now fully implements the JSON RPC protocol. Please test that nothing has been broken in the frontend and the API endpoint.

RESOLVED.

Generated at Sun Apr 20 21:13:18 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.