Bug 725721 - XMLRPC: various object ids returned as string instead of int
Summary: XMLRPC: various object ids returned as string instead of int
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: TCMS
Classification: Other
Component: Application
Version: 3.5
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Yuguang Wang
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 593666
TreeView+ depends on / blocked
 
Reported: 2011-07-26 11:35 UTC by Petr Šplíchal
Modified: 2016-06-01 01:42 UTC (History)
6 users (show)

Fixed In Version: 3.6.0-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-08 08:05:03 UTC


Attachments (Terms of Use)

Description Petr Šplíchal 2011-07-26 11:35:43 UTC
Description of problem:

Previously 'case_id' was returned as int. Now it's a string. This
API change breaks some of our scripts. We can work around this but
what's the point of this change?

Version-Release number of selected component (if applicable):
Nitrate 3.5.0

Steps to Reproduce:
TestCase.get(46490)
  
Actual results:
{'alias': '',
 'arguments': '',
 'author': 'psplicha',
 'author_id': 2117,
 'case_id': '46490',
 ...

Expected results:
{'alias': '',
 'arguments': '',
 'author': 'psplicha',
 'author_id': 2117,
 'case_id': 46490,
 ...

Comment 1 Petr Šplíchal 2011-08-17 07:23:36 UTC
Actually, I'm seeing similar change in other places, for example
TestCase.get_bugs() returns bug ids as string as well:

 {'bug_id': '697470', <--------------------------------
  'bug_system': 'Red Hat\nBugzilla',
  'bug_system_id': 1,
  'case': '/CoreOS/python/Regression/bz697470-uid-and-gid-overflows',
  'case_id': 108189,
  'case_run': 'None',
  'case_run_id': None,
  'description': 'None',
  'id': '15864',
  'summary': 'None'},

This is breaking more and more of our scripts. Today I had to
investigate and provide a workaround fix for another tool, already
4th if I count well.

What is the purpose of this change? Shall we expect other integers
to be provided in the future as strings as well? Could we get soon
the previous behavior to minimize further regressions?

Comment 2 Petr Šplíchal 2011-09-13 07:15:54 UTC
And the story continues...

[INFO] Fetching test case TC#6595
[DEBUG] Initializing test case TC#6595
[DEBUG] {'alias': 'None',
 'arguments': '',
 'author': 'psplicha',
 'author_id': 2117,
 'case_id': '6595',
 'case_status': 'CONFIRMED',
 'case_status_id': 2,
 'category': 'Security',
 'category_id': 228,
 'create_date': '2009-04-10 13:37:47',
 'default_tester': 'psplicha',
 'default_tester_id': 2117,
 'estimated_time': '00:05:00',
 'is_automated': '1',
 'is_automated_proposed': 'False',
 'notes': 'None',

Automated field returned as string '0'/'1' while proposed as
'True'/'False'. Hey, this is becoming really inconsistent!

Comment 3 David Kovalsky 2011-09-13 22:50:30 UTC
Are the values consistent with the XML-RPC docs linked from Nitrate WUI? Or will we need updating that too?
https://tcms.engineering.redhat.com/xmlrpc/

Comment 4 Petr Šplíchal 2011-09-14 07:08:20 UTC
(In reply to comment #3)
> Are the values consistent with the XML-RPC docs linked from Nitrate WUI? Or
> will we need updating that too?
> https://tcms.engineering.redhat.com/xmlrpc/

Unfortunately the documentation is quite terse regarding the
values and types returned by xmlrpc methods, for an example:

    TestCase.get
    Returns:     A blessed TestCase object Hash

Comment 5 Petr Šplíchal 2011-09-21 13:54:22 UTC
For another regression caused by this change see bug 737463.

Comment 6 Chaobin Tang 2011-09-22 09:30:04 UTC
We have come up with a HOTFIX that was dedicated to solve this problem. In this HOTFIX version, regarding to XMLRPC interface, the changes include -

1. In all XMLRPC calls, the returned value will be in their natural types. Taking 'case_id' as the example, now case_id will be in integer type.
2. In all XMLRPC calls, the returned value will include relationships whenever it applies. Taking TestCase.get as an example, the result will contain the key-value pair 'plan': [plan_id, plan_id, plan_id]. In our previous version, this information was never included.
3. When creating a XMLRPC session to the server, will set allow_none to True.

We have updated TCMS staging server with this HOTFIX version. Please feel free to test with your automation tools. And it is desired that you let us know of any problems. 

Staging server XMLRPC location -

http://tcms-stage.englab.bne.redhat.com/xmlrpc/

Comment 8 Jin Zhao 2011-09-28 04:56:39 UTC
(In reply to comment #7)
> Thanks for the hot fix! I've tested the updated API with
> our most used tools (tcms-submit, bkr workflow-tcms and
> tcms-results) and as for now everything seems to be ok.

Thanks Petr Šplíchal's reply. Refer to Petr Šplíchal's comment 7, The problem have been fixed. Change to VERIFIED.


Note You need to log in before you can comment on or make changes to this bug.