diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-09-04 11:08:11 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-09-04 11:20:24 -0700 |
| commit | f6450d9d6b848c59c0ca0fa1fc95f0e5eae1a1fe (patch) | |
| tree | adbf9d377819196a390cdd50ce236837d24d72be /taskflow/tests/unit | |
| parent | cd122d84d92e9e07842013fe148d0c399d28ec4b (diff) | |
| download | taskflow-f6450d9d6b848c59c0ca0fa1fc95f0e5eae1a1fe.tar.gz | |
Fix how the dir persistence backend was not listing logbooks
Due to the usage of the os.path.islink check this means that no
logbooks would be returned when get_logbooks was called, which is
not the behavior we want.
Closes-Bug: #1492403
Change-Id: Ife6a5bec777c9e2d820391914ce2c6fbbadf4f79
Diffstat (limited to 'taskflow/tests/unit')
| -rw-r--r-- | taskflow/tests/unit/persistence/base.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/taskflow/tests/unit/persistence/base.py b/taskflow/tests/unit/persistence/base.py index 0b56617..f5a20bd 100644 --- a/taskflow/tests/unit/persistence/base.py +++ b/taskflow/tests/unit/persistence/base.py @@ -69,6 +69,27 @@ class PersistenceTestMixin(object): self.assertIsNotNone(lb2.find(fd.uuid)) self.assertIsNotNone(lb2.find(fd2.uuid)) + def test_logbook_save_retrieve_many(self): + lb_ids = {} + for i in range(0, 10): + lb_id = uuidutils.generate_uuid() + lb_name = 'lb-%s-%s' % (i, lb_id) + lb = models.LogBook(name=lb_name, uuid=lb_id) + lb_ids[lb_id] = True + + # Should not already exist + with contextlib.closing(self._get_connection()) as conn: + self.assertRaises(exc.NotFound, conn.get_logbook, lb_id) + conn.save_logbook(lb) + + # Now fetch them all + with contextlib.closing(self._get_connection()) as conn: + lbs = conn.get_logbooks() + for lb in lbs: + self.assertIn(lb.uuid, lb_ids) + lb_ids.pop(lb.uuid) + self.assertEqual(0, len(lb_ids)) + def test_logbook_save_retrieve(self): lb_id = uuidutils.generate_uuid() lb_meta = {'1': 2} |
