Skip to content

Commit

Permalink
Restore test_removebuilds
Browse files Browse the repository at this point in the history
Half of this test was accidentally disabled in ...
  • Loading branch information
zackgalbreath committed Nov 22, 2024
1 parent e36f195 commit ebca0d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/Utils/DatabaseCleanupUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ public static function removeBuild($buildid) : void
// Use array_diff to get the list of tests that should be deleted.
$testoutputs_to_delete = array_diff($all_outputids, $testoutputs_to_save);
if (!empty($testoutputs_to_delete)) {
self::deleteRowsChunked('DELETE FROM testoutput WHERE id IN ', $testoutputs_to_delete);

$testoutputs_to_delete_prepare_array = $db->createPreparedArray(count($testoutputs_to_delete));
// Check if the images for the test are not shared
$test2image = DB::select("
Expand All @@ -291,6 +289,8 @@ public static function removeBuild($buildid) : void
$imgids_prepare_array = $db->createPreparedArray(count($imgids));
DB::delete("DELETE FROM image WHERE id IN $imgids_prepare_array", $imgids);
}

self::deleteRowsChunked('DELETE FROM testoutput WHERE id IN ', $testoutputs_to_delete);
}
}

Expand Down
8 changes: 4 additions & 4 deletions app/cdash/tests/test_removebuilds.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ public function testBuildRemovalWorksAsExpected()
$this->verify('label2dynamicanalysis', 'labelid', '=', $labelid, 1);
$this->verify('label2test', 'labelid', '=', $labelid, 3);

echo "Check on labelid = $labelid\n";
return;

// Remove the build.
DatabaseCleanupUtils::removeBuild($build->Id);

Expand Down Expand Up @@ -465,14 +462,17 @@ public function testBuildRemovalWorksAsExpected()
$this->verify('label2buildfailure', 'labelid', '=', $labelid, 1, true);
$this->verify('label2coveragefile', 'labelid', '=', $labelid, 1, true);
$this->verify('label2dynamicanalysis', 'labelid', '=', $labelid, 0, true);
$this->verify('label2test', 'labelid', '=', $labelid, 0, true);
$this->verify('label2test', 'labelid', '=', $labelid, 1, true);
$this->verify('note', 'id', 'IN', $noteids, 1, true);
$this->verify('summaryemail', 'buildid', '=', $build->Id, 0, true);
$this->verify('subproject2build', 'buildid', '=', $build->Id, 0, true);
$this->verify('test2image', 'outputid', 'IN', $outputids, 1, true);
$this->verify('testdiff', 'buildid', '=', $build->Id, 0, true);
$this->verify('updatefile', 'updateid', '=', $updateid, 1, true);
$this->verify('uploadfile', 'id', 'IN', $uploadfileids, 1, true);

// Remove the other build too to make this test idempotent.
DatabaseCleanupUtils::removeBuild($existing_build->Id);
}

public function verify($table, $field, $compare, $value, $expected, $deleted=false)
Expand Down

0 comments on commit ebca0d5

Please sign in to comment.