mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Tests: Revamp static bwc test framework to use dangling indexes
The static old index tests currently take a long time to run because each index version essentially recreates the cluster, and spins up new nodes. This PR instead loads each old version into the existing cluster as a dangling index. It also removes the intermediate "StaticIndexBackwardCompatibilityTest" which was an extra layer with no purpose, and moves a shared version of a commonly found function to get an http client. The test now takes between 40 and 60 seconds for me. I also ran it "under stress" by running all ES tests in one shell, while simultaneously running 10 iterations of the old index tests. Each iteration took on average about 90 seconds, which is much better than the 20+ minutes we see in master on jenkins. closes #10247
This commit is contained in:
parent
d379b3618e
commit
c3011cead4
91 changed files with 159 additions and 174 deletions
|
@ -158,7 +158,8 @@ def create_client(http_port, timeout=30):
|
|||
assert False, 'Timed out waiting for node for %s seconds' % timeout
|
||||
|
||||
def generate_index(client, version):
|
||||
client.indices.delete(index='test', ignore=404)
|
||||
name = 'index-%s' % version.lower()
|
||||
client.indices.delete(index=name, ignore=404)
|
||||
num_shards = random.randint(1, 10)
|
||||
num_replicas = random.randint(0, 1)
|
||||
logging.info('Create single shard test index')
|
||||
|
@ -228,7 +229,7 @@ def generate_index(client, version):
|
|||
}
|
||||
}
|
||||
|
||||
client.indices.create(index='test', body={
|
||||
client.indices.create(index=name, body={
|
||||
'settings': {
|
||||
'number_of_shards': 1,
|
||||
'number_of_replicas': 0
|
||||
|
@ -244,9 +245,9 @@ def generate_index(client, version):
|
|||
# lighter index for it to keep bw tests reasonable
|
||||
# see https://github.com/elastic/elasticsearch/issues/5817
|
||||
num_docs = num_docs / 10
|
||||
index_documents(client, 'test', 'doc', num_docs)
|
||||
index_documents(client, name, 'doc', num_docs)
|
||||
logging.info('Running basic asserts on the data added')
|
||||
run_basic_asserts(client, 'test', 'doc', num_docs)
|
||||
run_basic_asserts(client, name, 'doc', num_docs)
|
||||
|
||||
def snapshot_index(client, cfg):
|
||||
# Add bogus persistent settings to make sure they can be restored
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue