From 0f9410d06648e059ec6c0b72e3e8fa75b4c0690a Mon Sep 17 00:00:00 2001 From: DvirDukhan Date: Tue, 8 Mar 2022 16:19:25 +0200 Subject: [PATCH] 2.4.2 cherry picks (#2633) --- .circleci/config.yml | 14 ++-- coord/src/module.c | 12 ++-- docs/Commands.md | 6 ++ sbin/get-redisjson | 2 +- sbin/pack.sh | 5 +- sbin/upload-artifacts | 3 +- src/spec.c | 4 ++ src/spec.h | 3 +- src/version.h | 2 +- tests/pytests/test_replicate.py | 6 +- tests/pytests/test_vecsim.py | 36 ++++++---- tests/qa/RS_VERSIONS | 6 +- tests/qa/common.json | 27 ++++++++ tests/qa/nightly.json | 22 ------ tests/qa/qatests | 116 ++++++++++++++++++-------------- tests/qa/release.json | 23 ------- 16 files changed, 155 insertions(+), 132 deletions(-) create mode 100644 tests/qa/common.json delete mode 100644 tests/qa/nightly.json delete mode 100644 tests/qa/release.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 17dadc60c6..18234a316e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,7 +58,7 @@ commands: git submodule update --init deps/readies ./deps/readies/bin/getpy2 ./deps/readies/bin/getpy3 - python2 -m pip install awscli + python2 -m pip install -q awscli install-prerequisites: parameters: @@ -349,9 +349,9 @@ jobs: xcode: 12.4.0 steps: - early-returns - - run: - name: Brew upgrade - command: brew upgrade + # - run: + # name: Brew upgrade + # command: brew upgrade - run: name: Set up workspace command: mkdir -p ~/workspace @@ -507,10 +507,10 @@ jobs: - setup-automation - run: name: Run QA Automation - command: ./tests/qa/qatests -t release -m "$CIRCLE_TAG" + command: ./tests/qa/qatests -m "$CIRCLE_TAG" - run: name: Run QA Automation (RediSearch Light) - command: ./tests/qa/qatests -t release -m "$CIRCLE_TAG" --light + command: ./tests/qa/qatests -m "$CIRCLE_TAG" --light #---------------------------------------------------------------------------------------------------------------------------------- @@ -593,7 +593,7 @@ workflows: context: common matrix: parameters: - platform: [focal, bionic, xenial, centos7, ol8, bullseye] + platform: [focal, bionic, xenial, centos7, rocky8, bullseye] - build-arm-platforms: <<: *on-integ-and-version-tags context: common diff --git a/coord/src/module.c b/coord/src/module.c index c48b2c1ed1..e9c1cb6fde 100644 --- a/coord/src/module.c +++ b/coord/src/module.c @@ -1012,7 +1012,7 @@ static void knnPostProcess(searchReducerCtx *rCtx) { static void sendSearchResults(RedisModuleCtx *ctx, searchReducerCtx *rCtx) { // Reverse the top N results - rCtx->postProcess(rCtx); + rCtx->postProcess((struct searchReducerCtx *)rCtx); searchRequestCtx *req = rCtx->searchCtx; @@ -1167,8 +1167,8 @@ static int searchResultReducer(struct MRCtx *mc, int count, MRReply **replies) { heap_init(rCtx.pq, cmp_results, req, num); // Default result process and post process operations - rCtx.processReply = processSearchReply; - rCtx.postProcess = noOpPostProcess; + rCtx.processReply = (void (*)(struct redisReply *, struct searchReducerCtx *, RedisModuleCtx *))processSearchReply; + rCtx.postProcess = (void (*)(struct searchReducerCtx *))noOpPostProcess; if(req->specialCases) { @@ -1176,12 +1176,12 @@ static int searchResultReducer(struct MRCtx *mc, int count, MRReply **replies) { for(size_t i =0; i < nSpecialCases; i++) { if(req->specialCases[i]->specialCaseType == SPECIAL_CASE_KNN) { specialCaseCtx* knnCtx = req->specialCases[i]; - rCtx.postProcess = knnPostProcess; + rCtx.postProcess = (void (*)(struct searchReducerCtx *))knnPostProcess; rCtx.reduceSpecialCaseCtx = knnCtx; if(knnCtx->knn.shouldSort) { knnCtx->knn.pq = rm_malloc(heap_sizeof(knnCtx->knn.k)); heap_init(knnCtx->knn.pq, cmp_scored_results, NULL, knnCtx->knn.k); - rCtx.processReply = proccessKNNSearchReply; + rCtx.processReply =(void (*)(struct redisReply *, struct searchReducerCtx *, RedisModuleCtx *))proccessKNNSearchReply; rCtx.reduceSpecialCaseCtx = knnCtx; break; } @@ -1191,7 +1191,7 @@ static int searchResultReducer(struct MRCtx *mc, int count, MRReply **replies) { for (int i = 0; i < count; i++) { MRReply *reply = (!profile) ? replies[i] : MRReply_ArrayElement(replies[i], 0); - rCtx.processReply(reply, &rCtx, ctx); + rCtx.processReply(reply, (struct searchReducerCtx *)&rCtx, ctx); } if (rCtx.cachedResult) { free(rCtx.cachedResult); diff --git a/docs/Commands.md b/docs/Commands.md index 677377bea4..ccf1b6b303 100644 --- a/docs/Commands.md +++ b/docs/Commands.md @@ -317,6 +317,7 @@ FT.SEARCH {index} {query} [NOCONTENT] [VERBATIM] [NOSTOPWORDS] [WITHSCORES] [WIT [PAYLOAD {payload}] [SORTBY {attribute} [ASC|DESC]] [LIMIT offset num] + [TIMEOUT {milliseconds}] [PARAMS {nargs} {name} {value} ... ] ``` @@ -454,6 +455,8 @@ FT.SEARCH books-idx "*=>[KNN 10 @title_embedding $query_vec AS title_score]" PAR !!! tip `LIMIT 0 0` can be used to count the number of documents in the result set without actually returning them. +- **TIMEOUT {milliseconds}**: If set, we will override the timeout parameter of the module. + * **PARAMS {nargs} {name} {value}**. Define one or more value parameters. Each parameter has a name and a value. Parameters can be referenced in the query string by a `$`, followed by the parameter name, e.g., `$user`, and each such reference in the search query to a parameter name is substituted by the corresponding parameter value. For example, with parameter definition `PARAMS 4 lon 29.69465 lat 34.95126`, the expression `@loc:[$lon $lat 10 km]` would be evaluated to `@loc:[29.69465 34.95126 10 km]`. Parameters cannot be referenced in the query string where concrete values are not allowed, such as in field names, e.g., `@loc` #### Complexity @@ -490,6 +493,7 @@ FT.AGGREGATE {index_name} [APPLY {expr} AS {alias}] ... [LIMIT {offset} {num}] ... [FILTER {expr}] ... + [TIMEOUT {milliseconds}] ``` #### Description @@ -584,6 +588,8 @@ Here, we needed to use `LOAD` to pre-load the @location attribute because it is * **FILTER {expr}**. Filter the results using predicate expressions relating to values in each result. They are is applied post-query and relate to the current state of the pipeline. +* **TIMEOUT {milliseconds}**: If set, we will override the timeout parameter of the module. + #### Complexity Non-deterministic. Depends on the query and aggregations performed, but it is usually linear to the number of results returned. diff --git a/sbin/get-redisjson b/sbin/get-redisjson index d2a163b1be..69a9dd0b4e 100755 --- a/sbin/get-redisjson +++ b/sbin/get-redisjson @@ -69,7 +69,7 @@ else nick=ubuntu18.04 fi elif [[ $dist == centos || $dist == redhat || $dist == fedora || $dist == ol ]]; then - if [[ $nick == "centos8" || $nick == "ol8" ]]; then + if [[ $nick == "centos8" || $nick == "ol8" || $nick == "rocky8" ]]; then nick="rhel8" else nick="rhel7" diff --git a/sbin/pack.sh b/sbin/pack.sh index 584eba6500..a6908f1b7b 100755 --- a/sbin/pack.sh +++ b/sbin/pack.sh @@ -60,10 +60,11 @@ OSNICK=$($READIES/bin/platform --osnick) [[ $OSNICK == trusty ]] && OSNICK=ubuntu14.04 [[ $OSNICK == xenial ]] && OSNICK=ubuntu16.04 [[ $OSNICK == bionic ]] && OSNICK=ubuntu18.04 -[[ $OSNICK == focal ]] && OSNICK=ubuntu20.04 +[[ $OSNICK == focal ]] && OSNICK=ubuntu20.04 [[ $OSNICK == centos7 ]] && OSNICK=rhel7 [[ $OSNICK == centos8 ]] && OSNICK=rhel8 -[[ $OSNICK == ol8 ]] && OSNICK=rhel8 +[[ $OSNICK == ol8 ]] && OSNICK=rhel8 +[[ $OSNICK == rocky8 ]] && OSNICK=rhel8 PLATFORM="$OS-$OSNICK-$ARCH" diff --git a/sbin/upload-artifacts b/sbin/upload-artifacts index 0fe1b967e3..945aefbe30 100755 --- a/sbin/upload-artifacts +++ b/sbin/upload-artifacts @@ -43,7 +43,8 @@ OS=$($READIES/bin/platform --os) [[ $OSNICK == focal ]] && OSNICK=ubuntu20.04 [[ $OSNICK == centos7 ]] && OSNICK=rhel7 [[ $OSNICK == centos8 ]] && OSNICK=rhel8 -[[ $OSNICK == ol8 ]] && OSNICK=rhel8 +[[ $OSNICK == ol8 ]] && OSNICK=rhel8 +[[ $OSNICK == rocky8 ]] && OSNICK=rhel8 PLATFORM="$OS-$OSNICK-$ARCH" diff --git a/src/spec.c b/src/spec.c index 180d8d221d..fa59ee9200 100644 --- a/src/spec.c +++ b/src/spec.c @@ -1491,6 +1491,7 @@ static void FieldSpec_RdbSave(RedisModuleIO *rdb, FieldSpec *f) { RedisModule_SaveStringBuffer(rdb, &f->tagOpts.tagSep, 1); } if (FIELD_IS(f, INDEXFLD_T_VECTOR)) { + RedisModule_SaveUnsigned(rdb, f->vectorOpts.expBlobSize); VecSim_RdbSave(rdb, &f->vectorOpts.vecSimParams); } } @@ -1542,6 +1543,9 @@ static int FieldSpec_RdbLoad(RedisModuleIO *rdb, FieldSpec *f, int encver) { } // Load vector specific options if (encver >= INDEX_VECSIM_VERSION && FIELD_IS(f, INDEXFLD_T_VECTOR)) { + if (encver >= INDEX_VECSIM_2_VERSION) { + f->vectorOpts.expBlobSize = LoadUnsigned_IOError(rdb, goto fail); + } if (VecSim_RdbLoad(rdb, &f->vectorOpts.vecSimParams) != REDISMODULE_OK) { goto fail; } diff --git a/src/spec.h b/src/spec.h index f41b033225..47651fd702 100644 --- a/src/spec.h +++ b/src/spec.h @@ -180,7 +180,8 @@ typedef uint16_t FieldSpecDedupeArray[SPEC_MAX_FIELDS]; (Index_StoreFreqs | Index_StoreFieldFlags | Index_StoreTermOffsets | Index_StoreNumeric | \ Index_WideSchema) -#define INDEX_CURRENT_VERSION 19 +#define INDEX_CURRENT_VERSION 20 +#define INDEX_VECSIM_2_VERSION 20 #define INDEX_VECSIM_VERSION 19 #define INDEX_JSON_VERSION 18 #define INDEX_MIN_COMPAT_VERSION 17 diff --git a/src/version.h b/src/version.h index 8436a58ef9..ac6ef24e00 100644 --- a/src/version.h +++ b/src/version.h @@ -6,7 +6,7 @@ #define REDISEARCH_VERSION_MAJOR 2 #define REDISEARCH_VERSION_MINOR 4 -#define REDISEARCH_VERSION_PATCH 1 +#define REDISEARCH_VERSION_PATCH 2 #ifndef REDISEARCH_MODULE_NAME #define REDISEARCH_MODULE_NAME "search" diff --git a/tests/pytests/test_replicate.py b/tests/pytests/test_replicate.py index 1cf4048a49..1ac4da955b 100644 --- a/tests/pytests/test_replicate.py +++ b/tests/pytests/test_replicate.py @@ -98,6 +98,8 @@ def testDropReplicate(): env.assertTrue(master.execute_command("ping")) env.assertTrue(slave.execute_command("ping")) + env.expect('WAIT', '1', '10000').equal(1) # wait for master and slave to be in sync + ''' This test first creates documents Next, it creates an index so all documents are scanned into the index @@ -110,10 +112,10 @@ def testDropReplicate(): master.execute_command('HSET', 'doc%d' % j, 't', 'hello%d' % j, 'tg', 'world%d' % j, 'n', j, 'g', geo) # test for FT.DROPINDEX - master.execute_command('WAIT', 1, 1000) + env.expect('WAIT', '1', '10000').equal(1) # wait for master and slave to be in sync master.execute_command('FT.CREATE', 'idx', 'SCHEMA', 't', 'TEXT', 'n', 'NUMERIC', 'tg', 'TAG', 'g', 'GEO') master.execute_command('FT.DROPINDEX', 'idx', 'DD') - master.execute_command('WAIT', 1, 1000) + env.expect('WAIT', '1', '10000').equal(1) # wait for master and slave to be in sync # check that same docs were deleted by master and slave master_keys = sorted(master.execute_command('KEYS', '*')) diff --git a/tests/pytests/test_vecsim.py b/tests/pytests/test_vecsim.py index 89c0c5a754..746c5cb0cf 100644 --- a/tests/pytests/test_vecsim.py +++ b/tests/pytests/test_vecsim.py @@ -297,15 +297,17 @@ def test_with_fields(env): conn.execute_command('FT.CREATE', 'idx', 'SCHEMA', 'v', 'VECTOR', 'HNSW', '6', 'TYPE', 'FLOAT32', 'DIM', dimension, 'DISTANCE_METRIC', 'L2', 't', 'TEXT') load_vectors_with_texts_into_redis(conn, 'v', dimension, qty) - query_data = np.float32(np.random.random((1, dimension))) - res = env.cmd('FT.SEARCH', 'idx', '*=>[KNN 100 @v $vec_param AS score]', - 'SORTBY', 'score', 'PARAMS', 2, 'vec_param', query_data.tobytes(), - 'RETURN', 2, 'score', 't') - res_nocontent = env.cmd('FT.SEARCH', 'idx', '*=>[KNN 100 @v $vec_param AS score]', - 'SORTBY', 'score', 'PARAMS', 2, 'vec_param', query_data.tobytes(), - 'NOCONTENT') - env.assertEqual(res[1::2], res_nocontent[1:]) - env.assertEqual('t', res[2][2]) + for _ in env.retry_with_rdb_reload(): + waitForIndex(env, 'idx') + query_data = np.float32(np.random.random((1, dimension))) + res = env.cmd('FT.SEARCH', 'idx', '*=>[KNN 100 @v $vec_param AS score]', + 'SORTBY', 'score', 'PARAMS', 2, 'vec_param', query_data.tobytes(), + 'RETURN', 2, 'score', 't') + res_nocontent = env.cmd('FT.SEARCH', 'idx', '*=>[KNN 100 @v $vec_param AS score]', + 'SORTBY', 'score', 'PARAMS', 2, 'vec_param', query_data.tobytes(), + 'NOCONTENT') + env.assertEqual(res[1::2], res_nocontent[1:]) + env.assertEqual('t', res[2][2]) def get_vecsim_memory(env, index_key, field_name): @@ -736,10 +738,13 @@ def test_single_entry(env): conn.execute_command('FT.CREATE', 'idx', 'SCHEMA', 'v', 'VECTOR', 'HNSW', '6', 'TYPE', 'FLOAT32', 'DIM', dimension, 'DISTANCE_METRIC', 'L2') vector = np.random.rand(1, dimension).astype(np.float32) conn.execute_command('HSET', 0, 'v', vector.tobytes()) - env.expect('FT.SEARCH', 'idx', '*=>[KNN 10 @v $vec_param]', - 'SORTBY', '__v_score', - 'RETURN', '0', - 'PARAMS', 2, 'vec_param', vector.tobytes()).equal([1L, '0']) + + for _ in env.retry_with_rdb_reload(): + waitForIndex(env, 'idx') + env.expect('FT.SEARCH', 'idx', '*=>[KNN 10 @v $vec_param]', + 'SORTBY', '__v_score', + 'RETURN', '0', + 'PARAMS', 2, 'vec_param', vector.tobytes()).equal([1L, '0']) def test_hybrid_query_adhoc_bf_mode(env): @@ -760,7 +765,10 @@ def test_hybrid_query_adhoc_bf_mode(env): query_data = np.float32([100 for j in range(dimension)]) expected_res = [10L, '100', ['__v_score', '0', 't', 'other'], '90', ['__v_score', '12800', 't', 'other'], '80', ['__v_score', '51200', 't', 'other'], '70', ['__v_score', '115200', 't', 'other'], '60', ['__v_score', '204800', 't', 'other'], '50', ['__v_score', '320000', 't', 'other'], '40', ['__v_score', '460800', 't', 'other'], '30', ['__v_score', '627200', 't', 'other'], '20', ['__v_score', '819200', 't', 'other'], '10', ['__v_score', '1036800', 't', 'other']] - execute_hybrid_query(env, '(other)=>[KNN 10 @v $vec_param]', query_data, 't', batches_mode=False).equal(expected_res) + + for _ in env.retry_with_rdb_reload(): + waitForIndex(env, 'idx') + execute_hybrid_query(env, '(other)=>[KNN 10 @v $vec_param]', query_data, 't', batches_mode=False).equal(expected_res) def test_wrong_vector_size(env): diff --git a/tests/qa/RS_VERSIONS b/tests/qa/RS_VERSIONS index e9d421a076..717eb1fdcc 100644 --- a/tests/qa/RS_VERSIONS +++ b/tests/qa/RS_VERSIONS @@ -1,6 +1,8 @@ -6.2.4-54 +100.0.0-2721 6.0.8-32 6.0.12-58 6.0.20-101 +6.2.4-54 6.2.8-53 -100.0.0-2602 +6.2.10-83 +6.2.12-11 diff --git a/tests/qa/common.json b/tests/qa/common.json new file mode 100644 index 0000000000..dc6ebc39a8 --- /dev/null +++ b/tests/qa/common.json @@ -0,0 +1,27 @@ +{ + "service_id": "single_module_test_cycle", + "name": "redisearch automation-testing", + "properties": { + "sut_version": "{{RLEC_VERSION}}", + "email_recipients": "s5i1u4h5a8c8w2d7@redislabs.slack.com", + "sut_environments": [], + "tools_environment": {}, + "modules_version": "{{SEARCH_VERSION}}", + "test_names_modules": [ + "{{SEARCH_TEST_NAME}}" + ], + "global_spot_instances": "ondemand", + "module_download_url": true, + "module_download_urls": { + "{{SEARCH_DOWNLOAD_NAME}}": "http://redismodules.s3.amazonaws.com/{{SEARCH_DIR}}/{{SEARCH_FILE_PREFIX}}.{{RLEC_OS}}-{{RLEC_ARCH}}.{{SEARCH_VERSION}}.zip", + "ReJSON": "http://redismodules.s3.amazonaws.com/{{REJSON_DIR}}/{{REJSON_FILE_PREFIX}}.{{RLEC_OS}}-{{RLEC_ARCH}}.{{REJSON_VERSION}}.zip']" + }, + "cycle_environments_setup": [ + { + "teardown": true, + "name": "{{RLEC_ENV}}", + "concurrency": 1 + } + ] + } +} diff --git a/tests/qa/nightly.json b/tests/qa/nightly.json deleted file mode 100644 index 607cfc47dd..0000000000 --- a/tests/qa/nightly.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "service_id": "single_module_test_cycle", - "name": "redisearch automation-testing", - "properties": { - "sut_version": "{{RS_VERSION}}", - "email_recipients": "s5i1u4h5a8c8w2d7@redislabs.slack.com", - "sut_environments": [], - "tools_environment": {}, - "modules_version": "{{MODULE_VERSION}}", - "test_names_modules": [ - "{{RS_MODULE}}" - ], - "module_download_url": "['http://redismodules.s3.amazonaws.com/{{RS_MODULE_DIR}}/{{RS_MODULE_FILE_PREFIX}}.{{RS_MODULE_OS}}-x86_64.{{MODULE_VERSION}}.zip','http://redismodules.s3.amazonaws.com/{{REJSON_MODULE_DIR}}/{{REJSON_FILE_PREFIX}}.{{RS_MODULE_OS}}-x86_64.{{REJSON_VERSION}}.zip']", - "cycle_environments_setup": [ - { - "teardown": true, - "name": "{{RS_ENV}}", - "concurrency": 1 - } - ] - } -} diff --git a/tests/qa/qatests b/tests/qa/qatests index ec276a6ce6..450ae18f65 100755 --- a/tests/qa/qatests +++ b/tests/qa/qatests @@ -7,6 +7,7 @@ import click import re import json import requests +import urllib3 HERE = os.path.dirname(__file__) ROOT = os.path.abspath(os.path.join(HERE, "../..")) @@ -14,25 +15,31 @@ READIES = os.path.abspath(os.path.join(ROOT, "deps/readies")) sys.path.insert(0, READIES) import paella +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + + VERBOSE = 0 NOP = False OPERETO3_URL = "opereto.qa.redislabs.com" +DEFAULT_JSON_VER = '2.0.7' + -RS_PLATFORMS = { +RLEC_PLATFORMS = { 'xenial': { - 'platform': 'Linux-ubuntu16.04', + 'os': 'Linux-ubuntu16.04', 'env': 'xenial-amd64-aws' }, 'bionic': { - 'platform': 'Linux-ubuntu18.04', + 'os': 'Linux-ubuntu18.04', 'env': 'bionic-amd64-aws' }, 'centos7': { - 'platform': 'Linux-rhel7', + 'os': 'Linux-rhel7', 'env': 'rhel7.7-x86_64-aws' }, 'centos8': { - 'platform': 'Linux-rhel8', - 'env': 'rhel8-x86_64-aws' } - 'ol8': { - 'platform': 'Linux-rhel8', + 'os': 'Linux-rhel8', + 'env': 'rhel8-x86_64-aws', + 'run': False }, + 'rocky8': { + 'os': 'Linux-rhel8', 'env': 'rhel8-x86_64-aws' } } @@ -68,7 +75,7 @@ RS_VERSIONS file includes Redis Enterprive versions for release tests. class Test: - def __init__(self, token, test_fname, modver, snapshot, rsver, osnick, light): + def __init__(self, token, test_fname, modver, snapshot, jsonver, rlecver, osnick, light): global NOP, VERBOSE self.token = token @@ -76,51 +83,58 @@ class Test: modver = re.sub(r'^v(.*)', r'\1', modver) self.modver = modver self.snapshot = snapshot - self.rsver = rsver + self.jsonver = jsonver + self.rlecver = rlecver self.osnick = osnick self.light = light + self.module_name = "RediSearchLight" if self.light else "RediSearch" + + ENV['SEARCH_VERSION'] = modver + os.environ['SEARCH_DIR'] = 'redisearch' - os.environ['RS_MODULE_DIR'] = 'redisearch' - if light: - self.rsmod = 'RedisearchLight' - ENV['RS_MODULE_FILE_PREFIX'] = 'redisearch-light' + if not light: + ENV['SEARCH_FILE_PREFIX'] = 'redisearch' + ENV['SEARCH_DOWNLOAD_NAME'] = 'search' + ENV['SEARCH_TEST_NAME'] = 'RediSearchEnterprise' else: - self.rsmod = 'RediSearchEnterprise' - ENV['RS_MODULE_FILE_PREFIX'] = 'redisearch' + ENV['SEARCH_FILE_PREFIX'] = 'redisearch-light' + ENV['SEARCH_DOWNLOAD_NAME'] = 'searchlight' + ENV['SEARCH_TEST_NAME'] = 'RedisearchLight' + if snapshot: - ENV['RS_MODULE_FILE_PREFIX'] = "snapshots/" + ENV['RS_MODULE_FILE_PREFIX'] + ENV['SEARCH_FILE_PREFIX'] = "snapshots/" + ENV['SEARCH_FILE_PREFIX'] - ENV['RS_MODULE'] = self.rsmod - ENV['MODULE_VERSION'] = modver - ENV['RS_VERSION'] = rsver + ENV['RLEC_VERSION'] = rlecver + ENV['RLEC_ARCH'] = 'x86_64' - ENV['REJSON_MODULE_DIR'] = 'rejson' + ENV['REJSON_VERSION'] = self.jsonver + ENV['REJSON_DIR'] = 'rejson' ENV['REJSON_FILE_PREFIX'] = 'rejson' - ENV['REJSON_VERSION'] = '2.0.6' - self.xtx_vars = ['RS_MODULE', 'RS_MODULE_DIR', 'RS_MODULE_FILE_PREFIX', - 'RS_VERSION', 'RS_ENV', 'RS_MODULE_OS', - 'MODULE_VERSION', - 'REJSON_VERSION', 'REJSON_MODULE_DIR', 'REJSON_FILE_PREFIX'] + self.xtx_vars = ['SEARCH_VERSION', 'SEARCH_DIR', 'SEARCH_FILE_PREFIX', + 'SEARCH_TEST_NAME', 'SEARCH_DOWNLOAD_NAME', + 'RLEC_VERSION', 'RLEC_ENV', 'RLEC_OS', 'RLEC_ARCH', + 'REJSON_VERSION', 'REJSON_DIR', 'REJSON_FILE_PREFIX'] def run(self): found_osnick = False - for osnick in RS_PLATFORMS.keys(): + click.echo(f"Testing {self.module_name}/{self.modver} for RS {self.rlecver}:") + for osnick in RLEC_PLATFORMS.keys(): + if self.osnick is None: + if 'run' in RLEC_PLATFORMS[osnick] and RLEC_PLATFORMS[osnick]['run'] is False: + continue if self.osnick is None or osnick == self.osnick: found_osnick = True - rs_platform = RS_PLATFORMS[osnick]['platform'] - rs_env = RS_PLATFORMS[osnick]['env'] - self.run_for_os(rs_platform, rs_env) + rlec_os = RLEC_PLATFORMS[osnick]['os'] + rlec_env = RLEC_PLATFORMS[osnick]['env'] + self.run_for_os(rlec_os, rlec_env) if not found_osnick: - click.echo(f"osnick {self.osnick}: not found") + click.echo(f" osnick {osnick}: not found") + + def run_for_os(self, rlec_os, rlec_env): + ENV['RLEC_OS'] = rlec_os + ENV['RLEC_ENV'] = rlec_env - def run_for_os(self, rs_mod_os, rs_env): - ENV['RS_ENV'] = rs_env - ENV['RS_MODULE_OS'] = rs_mod_os - - desc = f"{self.rsmod}/{self.modver}/{rs_mod_os} for RS {self.rsver}" - click.echo(f"Testing {desc}") - global NOP, VERBOSE var_args = ' '.join(map(lambda v: f"-e {v}", self.xtx_vars)) @@ -141,42 +155,42 @@ class Test: fatal(x) if NOP: + click.echo(f" {rlec_os}: https://{OPERETO3_URL}/ui#dashboard/flow/...") return 0 - BB() res = requests.post(f"https://{OPERETO3_URL}/processes", verify=False, headers={'Authorization': f'Bearer {self.token}', 'Content-Type': 'application/json'}, data=rest) if not res.ok: - click.echo(f"Failed to run tests on {desc}: {res.reason} [{res.status_code}]") + click.echo(f" {rlec_os}: error: {res.reason} [{res.status_code}]") return 1 j = json.loads(res.content) if j['status'] != 'success': err = j['text'] - click.echo(f"Failed to run tests on {desc}: {err}") + click.echo(f" {rlec_os}: error: {err}") return 1 self.id = j['data'][0] # click.echo(f"Tests running on {desc}") - click.echo(f"Results: https://{OPERETO3_URL}/ui#dashboard/flow/{self.id}") + click.echo(f" {rlec_os}: https://{OPERETO3_URL}/ui#dashboard/flow/{self.id}") return 0 @click.command(help='Invoke QA Automation tests', cls=Command1) @click.option('--token', default=None, help='QA automation (Opereto) token (also: QA_AUTOMATION_TOKEN env var)') -@click.option('--test', '-t', default='release', help='Name of .json parameters file') +@click.option('--test', '-t', default='common', help='Name of .json parameters file') @click.option('--modver', '-m', default='master', help='Module version to test. Default: master') +@click.option('--jsonver', default=DEFAULT_JSON_VER, help='RedisJSON version to test') @click.option('--snapshot', '-s', is_flag=True, default=False, help='Test a snapshoy module version') -@click.option('--rsver', default=None, help='Test for a RS version`') +@click.option('--rlecver', '-r', default=None, help='Test for a RLEC version`') @click.option('--osnick', default=None, help='Test for OSNICK`') @click.option('--light', is_flag=True, default=False, help='Test RediSearch Light') @click.option('--quick', is_flag=True, default=False, help='Only test one RS version') @click.option('--nop', is_flag=True, default=False, help='Dry run') @click.option('--verbose', '-v', is_flag=True, default=False, help='Be verbose') @click.option('--verbosity', type=int, default=0, help='Verbosity level') -def main(token, test, modver, snapshot, rsver, osnick, light, quick, nop, verbose, verbosity, *args, **kwargs): - BB() +def main(token, test, modver, snapshot, jsonver, rlecver, osnick, light, quick, nop, verbose, verbosity, *args, **kwargs): global NOP, VERBOSE VERBOSE = 1 if verbose else verbosity NOP = nop @@ -189,14 +203,16 @@ def main(token, test, modver, snapshot, rsver, osnick, light, quick, nop, verbos if not os.path.exists(test_fname): raise click.ClickException(f"Invalid test name: {test}") - if rsver is not None: - Test(token, test_fname, modver, snapshot, rsver, osnick, light).run() + if modver == 'master': + snapshot = True + if rlecver is not None: + Test(token, test_fname, modver, snapshot, jsonver, rlecver, osnick, light).run() else: rs_versions = paella.flines(os.path.join(HERE, 'RS_VERSIONS')) if quick: rs_versions = [rs_versions[0]] - for rsver in rs_versions: - Test(token, test_fname, modver, snapshot, rsver, osnick, light).run() + for rlecver in rs_versions: + Test(token, test_fname, modver, snapshot, jsonver, rlecver, osnick, light).run() if __name__ == '__main__': diff --git a/tests/qa/release.json b/tests/qa/release.json deleted file mode 100644 index 3d47af44de..0000000000 --- a/tests/qa/release.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "service_id": "single_module_test_cycle", - "name": "redisearch automation-testing", - "properties": { - "sut_version": "{{RS_VERSION}}", - "email_recipients": "s5i1u4h5a8c8w2d7@redislabs.slack.com", - "sut_environments": [], - "tools_environment": {}, - "modules_version": "{{MODULE_VERSION}}", - "test_names_modules": [ - "{{RS_MODULE}}" - ], - "global_spot_instances": "ondemand", - "module_download_url": "['http://redismodules.s3.amazonaws.com/{{RS_MODULE_DIR}}/{{RS_MODULE_FILE_PREFIX}}.{{RS_MODULE_OS}}-x86_64.{{MODULE_VERSION}}.zip','http://redismodules.s3.amazonaws.com/{{REJSON_MODULE_DIR}}/{{REJSON_FILE_PREFIX}}.{{RS_MODULE_OS}}-x86_64.{{REJSON_VERSION}}.zip']", - "cycle_environments_setup": [ - { - "teardown": true, - "name": "{{RS_ENV}}", - "concurrency": 1 - } - ] - } -}