Remove duplicate check from task diag (#3545)

This commit is contained in:
koleesch 2024-07-07 19:19:54 +02:00 committed by GitHub
parent 6d3519419e
commit 847c482c25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 79 deletions

View file

@ -300,35 +300,8 @@ int CmdDiagnostics::execute (std::string& output)
<< Context::getContext ().getHeight ()
<< '\n';
// Scan tasks for duplicate UUIDs.
auto all = Context::getContext ().tdb2.all_tasks ();
std::map <std::string, int> seen;
std::vector <std::string> dups;
std::string uuid;
for (auto& i : all)
{
uuid = i.get ("uuid");
if (seen.find (uuid) != seen.end ())
dups.push_back (uuid);
else
seen[uuid] = 0;
}
out << " Dups: "
<< format ("Scanned {1} tasks for duplicate UUIDs:", all.size ())
<< '\n';
if (dups.size ())
{
for (auto& d : dups)
out << " " << format ("Found duplicate {1}", d) << '\n';
}
else
{
out << " No duplicates found\n";
}
// Check all the UUID references
auto all = Context::getContext ().tdb2.all_tasks ();
bool noBrokenRefs = true;
out << " Broken ref: "

View file

@ -206,11 +206,6 @@ class TestRecurrenceTasks(TestCase):
code, out, err = self.t("3 delete", input="y\n")
self.assertIn("Deleted 1 task.", out)
# Check for duplicate UUIDs.
code, out, err = self.t("diag")
self.assertIn("No duplicates found", out)
class TestBug972(TestCase):
def setUp(self):
"""972: Executed before each test in the class"""
@ -478,11 +473,6 @@ class TestBug360AllowedChanges(BaseTestBug360):
expected = "You cannot remove the due date from a recurring task."
self.assertNotIn(expected, err)
# Make sure no duplicate tasks were created
code, out, err = self.t.diag()
expected = "No duplicates found"
self.assertIn(expected, out)
class TestBug649(TestCase):
def setUp(self):
"""Executed before each test in the class"""
@ -602,11 +592,6 @@ class TestPeriod(TestCase):
self.assertIn(" 2q ", out);
self.assertIn(" 2y ", out);
# Duplicate check
code, out, err = self.t("diag")
self.assertIn("No duplicates found", out)
class TestBugAnnual(TestCase):
def setUp(self):
"""Executed before each test in the class"""

View file

@ -174,42 +174,6 @@ class TestUUID(TestCase):
self.assertIn('"description":"seven"', out)
class TestUUIDuplicates(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_uuid_duplicates_dupe(self):
"""Verify that duplicating tasks does not create duplicate UUIDs"""
self.t("add simple")
self.t("1 duplicate")
uuids = list()
for id in range(1,3):
code, out, err = self.t("_get %d.uuid" % id)
uuids.append(out.strip())
self.assertEqual(len(uuids), len(set(uuids)))
code, out, err = self.t("diag")
self.assertIn("No duplicates found", out)
def test_uuid_duplicates_recurrence(self):
"""Verify that recurring tasks do not create duplicate UUIDs"""
print(self.t("add periodic recur:daily due:yesterday"))
self.t("list") # GC/handleRecurrence
uuids = list()
for id in range(1,5):
code, out, err = self.t("_get %d.uuid" % id)
uuids.append(out.strip())
self.assertEqual(len(uuids), len(set(uuids)))
code, out, err = self.t("diag")
self.assertIn("No duplicates found", out)
class TestBug954(TestCase):
def setUp(self):
"""Executed before each test in the class"""