Esempio n. 1
0
 def test_index_manager_get_indexes_by_alias_with_duplicate(self):
     """
     Clean up the aliases when starting from a broken state: duplicate indexes for an alias.
     """
     alias = "richie_courses"
     existing_indexes = {
         "richie_courses_2013-05-04-03h12m33.123456s": {},
         "richie_courses_2014-05-04-03h12m33.123456s": {
             "aliases": {
                 "richie_courses": True
             }
         },
         "richie_courses_2015-05-04-03h12m33.123456s": {
             "aliases": {
                 "richie_courses": True
             }
         },
         "richie_organizations_2017-05-04-03h12m33.123456s": {
             "aliases": {
                 "richie_organizations": True
             }
         },
     }
     self.assertEqual(
         list(get_indexes_by_alias(existing_indexes, alias)),
         [
             ("richie_courses_2014-05-04-03h12m33.123456s",
              "richie_courses"),
             ("richie_courses_2015-05-04-03h12m33.123456s",
              "richie_courses"),
         ],
     )
Esempio n. 2
0
 def test_get_indexes_by_alias_empty(self):
     """
     Don't wrongly push values when there is nothing to return.
     """
     alias = "richie_courses"
     existing_indexes = {
         "richie_courses_2013-05-04-03h12m33.123456s": {},
         "richie_organizations_2017-05-04-03h12m33.123456s": {
             "aliases": {"richie_organizations": True}
         },
     }
     self.assertEqual(list(get_indexes_by_alias(existing_indexes, alias)), [])
Esempio n. 3
0
 def test_get_indexes_by_alias(self):
     """
     Receive a generator that contains the n-1 index for an alias.
     """
     alias = "richie_courses"
     existing_indexes = {
         "richie_courses_2014-05-04-03h12m33.123456s": {},
         "richie_courses_2015-05-04-03h12m33.123456s": {
             "aliases": {"richie_courses": True}
         },
         "richie_organizations_2017-05-04-03h12m33.123456s": {
             "aliases": {"richie_organizations": True}
         },
     }
     self.assertEqual(
         list(get_indexes_by_alias(existing_indexes, alias)),
         [("richie_courses_2015-05-04-03h12m33.123456s", "richie_courses")],
     )