Esempio n. 1
0
 def setUp(self):
     self.index_info = DOMAIN_INDEX_INFO
     self.elasticsearch = get_es_new()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
     import time
     time.sleep(1)  # without this we get a 503 response about 30% of the time
Esempio n. 2
0
 def setUp(self):
     super(DomainPillowTest, self).setUp()
     self.index_info = DOMAIN_INDEX_INFO
     self.elasticsearch = get_es_new()
     delete_all_domains()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
Esempio n. 3
0
 def setUp(self):
     super(UserPillowTestBase, self).setUp()
     self.index_info = USER_INDEX_INFO
     self.elasticsearch = get_es_new()
     delete_all_users()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
Esempio n. 4
0
 def setUp(self):
     self.index_info = DOMAIN_INDEX_INFO
     self.elasticsearch = get_es_new()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
     import time
     time.sleep(1)  # without this we get a 503 response about 30% of the time
Esempio n. 5
0
 def setUp(self):
     super(DomainPillowTest, self).setUp()
     self.index_info = DOMAIN_INDEX_INFO
     self.elasticsearch = get_es_new()
     delete_all_domains()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
Esempio n. 6
0
 def setUp(self):
     super(UserPillowTestBase, self).setUp()
     self.index_info = USER_INDEX_INFO
     self.elasticsearch = get_es_new()
     delete_all_users()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
Esempio n. 7
0
    def test_index_operations(self):
        initialize_index_and_mapping(self.es, TEST_INDEX_INFO)
        self.assertTrue(self.es.indices.exists(self.index))

        # delete and check
        self.es.indices.delete(self.index)
        self.assertFalse(self.es.indices.exists(self.index))

        # create and check
        initialize_index(self.es, TEST_INDEX_INFO)
        self.assertTrue(self.es.indices.exists(self.index))
Esempio n. 8
0
    def test_index_operations(self):
        initialize_index_and_mapping(self.es, TEST_INDEX_INFO)
        self.assertTrue(self.es.indices.exists(self.index))

        # delete and check
        self.es.indices.delete(self.index)
        self.assertFalse(self.es.indices.exists(self.index))

        # create and check
        initialize_index(self.es, TEST_INDEX_INFO)
        self.assertTrue(self.es.indices.exists(self.index))
    def test_index_operations(self):
        pillow = TestElasticPillow()
        self.assertTrue(self.es.indices.exists(self.index))

        # delete and check
        pillow.get_es_new().indices.delete(self.index)
        self.assertFalse(self.es.indices.exists(self.index))

        # create and check
        initialize_index(pillow.get_es_new(), get_index_info_from_pillow(pillow))
        self.assertTrue(self.es.indices.exists(self.index))
Esempio n. 10
0
def _initialize_target(es, target_index_info):
    if es.indices.exists(target_index_info.index):
        print(
            f"Target index '{target_index_info.index}' already exists. Skipping initialization."
        )
        return

    print("Creating target index")

    print("\tEnabling cluster routing")
    es.cluster.put_settings(
        {"transient": {
            "cluster.routing.allocation.enable": "all"
        }})

    initialize_index(es, target_index_info)
    set_index_reindex_settings(es, target_index_info.index)

    print("\tSetting number of replicas to 0")
    es.indices.put_settings({"index.number_of_replicas": 0},
                            index=target_index_info.index)

    for i in range(6):
        health = es.cluster.health(index=target_index_info.index)
        status = health["status"]
        if status == "green":
            break

        print(
            f"\tWaiting for index status to be green. Current status: '{status}'"
        )
        time.sleep(5)

    print("\tDisabling cluster routing")
    es.cluster.put_settings(
        {"transient": {
            "cluster.routing.allocation.enable": "none"
        }})
 def setUp(self):
     self.elasticsearch = get_es_new()
     ensure_index_deleted(GROUP_INDEX_INFO.index)
     initialize_index(self.elasticsearch, GROUP_INDEX_INFO)
     delete_all_groups()
Esempio n. 12
0
 def setUp(self):
     self.elasticsearch = get_es_new()
     for index in [GROUP_INDEX_INFO, USER_INDEX_INFO]:
         ensure_index_deleted(index.index)
         initialize_index(self.elasticsearch, index)
     delete_all_groups()
Esempio n. 13
0
 def setUp(self):
     self.index_info = USER_INDEX_INFO
     self.elasticsearch = get_es_new()
     delete_all_users()
     ensure_index_deleted(self.index_info.index)
     initialize_index(self.elasticsearch, self.index_info)
Esempio n. 14
0
 def setUp(self):
     self.elasticsearch = get_es_new()
     ensure_index_deleted(GROUP_INDEX_INFO.index)
     initialize_index(self.elasticsearch, GROUP_INDEX_INFO)
     delete_all_groups()
Esempio n. 15
0
 def setUp(self):
     self.elasticsearch = get_es_new()
     for index in [GROUP_INDEX_INFO, USER_INDEX_INFO]:
         ensure_index_deleted(index.index)
         initialize_index(self.elasticsearch, index)
     delete_all_groups()