Updating an ATF test that is included in a test suite with a filter condition can leave orphaned sys_metadata records


If there is an ATF test suite that uses the "Filter" feature to populate itself with tests that match a filter, then updating any record for a test that is added to that suite will leave invalid records in sys_metadata.

These invalid records have no effect on the functionality of ATF. They will show up in the list view for sys_metadata, but cannot be opened, and attempting to preview them will show "No preview available."

Steps to Reproduce

1) Navigate to Automated Test Framework (ATF) > Suites module and click "New"
2) Input any name
3) For Filter, put "Name <starts with> My New Test" (any filter condition can be used so long as the test created in step 6 matches the condition)
4) Click "Save"
5) Navigate to Automated Test Framework (ATF) > Tests module and click "New"
6) Create a test that matches the filter from step 3 -- if following along these steps the test can be called "My New Test 1"
7) Click "Save"
8) Copy the sys_id for the newly created test -- the easiest way to do this as an admin is right-click the header of the form and click "Copy sys_id"
9) Navigate to sys_metadata by typing "sys_metadata.list" into the left-nav and pressing enter
10) Apply the filter "Display name <is> [sys_id from step 8]" (make sure to replace the actual sys_id from step 8 in the filter)
11) Confirm that there is exactly one sys_atf_test_suite_test record that matches that filter
12) Navigate back to the test from Step 4, set the Description field to any value, and update the record
13) Repeat steps 9 and 10

Expected: There should still be exaclty one record that matches the filter
Observed: There are now 2 records matching the filter. The original one from step 11 is still there and valid, and the second one is an invalid record that cannot be opened or deleted
Repeating steps 12 and 13 will produce additional invalid records


There is no known workaround for this issue. However, the invalid records will not affect the functionality of ATF or the test suite in any way.

Related Problem: PRB1499240