DB appears corrupted, Only 1 test plan shown per project

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
sander_pool
TestLink user
Posts: 12
Joined: Thu May 10, 2012 8:17 pm
Location: CT - USA

DB appears corrupted, Only 1 test plan shown per project

Post by sander_pool »

Hi,

I have something odd going on with my 1.9.5 install. I have two projects, one for actual product testing, the other for testing API access. I have created a couple of test plans in each project. Still the drop box only shows 1 test plan for each project. Using phpmyadmin I can see the entries in the nodes_hierarchy table. When I try to re-create test plans with a name that I've used before but is not shown the create fails.

I have run mysqlcheck against the database and it says it's fine. Somehow my tables got messed up. Are there things I can check? The API returns all test plans I have created so far. On the other hand when I try to associate a new test case with a testplan using the API this only works for 1 project, not the other.

The script I'm working on creates test suites and test cases as needed before entering results for them. Before entering results it needs to add test cases to the right plan. This fails with one project but succeeds with another.

I'll gladly open a Mantis ticket if you think there is a bug in TestLink but I think in this case that might not be appropriate as the database appears suspect. How do I debug this? I'd rather not start with a fresh database.

Thanks,

Sander
Principal QA Automation Engineer at Somewhere
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: DB appears corrupted, Only 1 test plan shown per project

Post by fman »

1. public attribute of these test plan ?
may be issue is related to PRIVATE TEST PLANS

2. You can do a test using your DB (a copy) with latest code from gitorious that solves several issues

3. if you want / need consultant service => contact francisco.mancardi@gmail.com
sander_pool
TestLink user
Posts: 12
Joined: Thu May 10, 2012 8:17 pm
Location: CT - USA

Re: DB appears corrupted, Only 1 test plan shown per project

Post by sander_pool »

Thanks for your reply.

1) Yes, there were private plans. Using phpmyadmin I set is_public to 1. Still they did not show up. I then set 'active' to 1 and finally the plans show. This is a bug, all plans should be listed even if they accidentally get created inactive and private. I'm admin and the only person creating plans. I'll log a ticket in Mantis.

2) OK, will give that a try.

3) If things get really bad I'll propose that to my boss.

Unfortunately this doesn't solve the API issue I'm having. In one project I still can't add test cases to a testplan right after I create it. This works fine in other projects so my code and the TL code isn't completely broken. There is some inconsistency in the database. It's so bad that the API call errors with non-XML output so it can't even be parsed. Using verbose XMLRPC I see the response is this:

Code: Select all

"<pre> ============================================================================== </pre><pre> DB Access Error - debug_print_backtrace() OUTPUT START </pre><pre> The query: [b] INSERT INTO testplan_tcversions (testplan_id,tcversion_id,author_id,creation_ts,node_order) VALUES(1543,237,9,'2013-05-09 11:37:19',1)[/b]</pre><pre> ============================================================================== </pre><pre>#0  database->exec_query() called at [/tools/testlink/lib/api/xmlrpc.class.php:2947]\n#1  TestlinkXMLRPCServer->addTestCaseToTestPlan() called at [/tools/testlink/third_party/xml-rpc/class-IXR.php:347]\n#2  IXR_Server->call() called at [/tools/testlink/third_party/xml-rpc/class-IXR.php:299]\n#3  IXR_Server->serve() called at [/tools/testlink/third_party/xml-rpc/class-IXR.php:282]\n#4  IXR_Server->IXR_Server() called at [/tools/testlink/lib/api/xmlrpc.class.php:254]\n#5  TestlinkXMLRPCServer->__construct() called at [/tools/testlink/lib/api/xmlrpc.php:25]\n</pre><pre> ============================================"
I traced the origin of the error and added the printing of the SQL statement (bold added during posting) that caused the problem. When I run that SQL statement in phmyadmin I see that the error is a duplicate key:

Code: Select all

#1062 - Duplicate entry '1543-237-0' for key 'testplan_tcversions_tplan_tcversion'
If someone can explain what testplan_tcversions contains I can attempt to write an fsck script.

Thanks,

Sander
Principal QA Automation Engineer at Somewhere
sander_pool
TestLink user
Posts: 12
Joined: Thu May 10, 2012 8:17 pm
Location: CT - USA

Re: DB appears corrupted, Only 1 test plan shown per project

Post by sander_pool »

So really this error means the API is attempting to re-insert the same testplan_tcversions record. Indeed the record that ties plan 1543 with tcversion 237 already exists.

That means somehow an earlier lookup failed, probably because of a join with a table that's missing a record. I attempted to untangle that code before but gave up on it. I guess I have to jump back in. First I need to start logging all MySQL queries. I tried to enable logging but nothing shows up. Guess I have to fix that first.
Principal QA Automation Engineer at Somewhere
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: DB appears corrupted, Only 1 test plan shown per project

Post by fman »

There is one post were info and/or pointers to DB schema exists, this will help us to understand how testplan_tcversions table work.
IHMO if you have used TestLink for a while, you have used the feature that add a testcase version to a test plan (and platform if you use it).
This is the info that exist in this table (I've always supposed that table name is clear enough).
May be what is need is add a check on API to avoid the crash if the record exist.
If you think this is the case, please open an issue on mantis.
Post Reply