ATF records created are not rolled back


Description

Automated test framework (ATF) test which should be rolled back after test execution is not working as expected and leaving records in sc_request and sc_req_item tables.

Steps to Reproduce:

  1. Create an ATF test with below steps
    • Impersonate "ATF User"
    • Open a Catalog Item "Install Software" (Any catalog item)
    • Set Field Values -> Fill the mandatory Fields
    • Order Catalog item.
  2. Run ATF test and check if the records are created in "sc_request" and "sc_req_item".(Ideally, the tests executed in ATF test should be rolled back).
  3. Go to Service Catalog -> Catalog Definition -> Maintain Items and filter with Catalog Item that used for testing.
  4. Personalize and add field "Use cart Layout" to the list view and see the value for a specific catalog item.
  5. If the value is "true", change it to false and save.
  6. Run the ATF test again and see the records are created in respective tables but not rolled back

Analysis:

 

  1. Go to the ATF test and run the test. This test will create records in sc_request and sc_req_item tables. 
  2. Check sys_rollback_context by filtering with "From Version" or "To version" contains sys_id of the test.
  3. The state of the ATF will be shown as "Rolled Back".
  4. Check server logs as it shows as below.

    2019-03-13 02:22:27 (172) worker.0 worker.0 txid=602f97531bcc Executing UI steps with order 2 - 5
    2019-03-13 02:22:42 (208) worker.0 worker.0 txid=602f97531bcc Unimpersonating after executing test: 8b7e9bdf1b8cff402a2d202e6e4bcbd7
    2019-03-13 02:22:42 (240) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:Rollback: Reverting from: ExecuteUserTest_8b7e9bdf1b8cff402a2d202e6e4bcbd7_end2019-03-13 09:22:26, to: ExecuteUserTest_8b7e9bdf1b8cff402a2d202e6e4bcbd7_start2019-03-13 09:22:26
    2019-03-13 02:22:42 (254) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:system paused
    2019-03-13 02:22:42 (295) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:Skipping schema rollback, no schema changes associated with this rollback context
    2019-03-13 02:22:43 (270) worker.0 worker.0 txid=602f97531bcc Time: 0:00:00.968 id: bptest_1[glide.6] for: SELECT sys_rollback_incremental0.`newvalue`, sys_rollback_incremental0.`row_mod_count`, sys_rollback_incremental0.`document_id`, sys_rollback_incremental0.`table_name`, sys_rollback_incremental0.`when`, sys_rollback_incremental0.`txn_id`, sys_rollback_incremental0.`number`, sys_rollback_incremental0.`storage_alias`, sys_rollback_incremental0.`context`, sys_rollback_incremental0.`storage_table_name`, sys_rollback_incremental0.`element_name`, sys_rollback_incremental0.`operation`, sys_rollback_incremental0.`oldvalue` FROM sys_rollback_incremental sys_rollback_incremental0  WHERE sys_rollback_incremental0.`txn_id` = '9d2f5b53f7ccff40712009612da5e672' /* bptest006, gs:glide.scheduler.worker.0, tx:602f97531bccff402a2d202e6e4bcb28 */ 
    2019-03-13 02:22:43 (275) worker.0 worker.0 txid=602f97531bcc ProgressReporter:Reverted: 3 of 3: (#166092) insert sys_variable_value.242f1b531bccff402a2d202e6e4bcbf7
    2019-03-13 02:22:43 (279) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:Skipping UI element (snapshot) rollback, no snapshot tables associated with this type
    2019-03-13 02:22:43 (279) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:Skipping cache flush rollback, no cache flushes recorded
    2019-03-13 02:22:43 (282) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:Rollback finished
    2019-03-13 02:22:43 (282) worker.0 worker.0 txid=602f97531bcc RollbackExecutor:system resumes normal operations
    2019-03-13 02:22:43 (304) worker.0 worker.0 txid=602f97531bcc ATFRollback: ATFRollback: Rollback completed successfully after 1 attempts
    2019-03-13 02:22:43 (313) worker.0 worker.0 txid=602f97531bcc Passing tracker (282fd3531bccff402a2d202e6e4bcb95)
    2019-03-13 02:22:43 (326) worker.0 worker.0 txid=602f97531bcc Completed: Test 'CFG_ATF_CreateApplicationPackage A in 0:00:16.483, next occurrence is null
  5. Logs also show that rollback is successful, but the records in sc_request and sc_req_item still exist.

Cause

The field: Use Cart Layout in Service Catalog -> Catalog Definition -> Maintain Items is the cause for the issue. The rollback_context params are not being submitted when the request is placed for items with "use_cart_layouts=FALSE". 

 

Resolution

The rollback will work properly when the request is placed for items with "use_cart_layouts=TRUE"

  1. Go to Service Catalog -> Catalog Definition -> Maintain Items
  2. Filter with Catalog item name
  3. Check the value for "Use Cart Layout".
  4. Change it to TRUE if shown as FALSE.
  5. Run the ATF test once again and see record creations are rolled back.