Skip to content

Commit 7a92bf3

Browse files
authored
chore: Enable valkey-search tests in CI (#6021)
* fix: valkey-search tests added to ci * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments * fix: review comments
1 parent 7e00d99 commit 7a92bf3

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed

.github/actions/regression-tests/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ runs:
3737
# bring back timeouts once composite actions start supporting them
3838
# timeout-minutes: 20
3939
steps:
40+
- name: Sync valkey-search tests
41+
shell: bash
42+
run: |
43+
cd ${GITHUB_WORKSPACE}/tests/dragonfly/valkey_search
44+
./sync-valkey-search-tests.sh 90124dc91756b24cb2e58e5c4eea5b8d53004ea6 # main branch revision
4045
- name: Run PyTests
4146
id: main
4247
shell: bash
@@ -47,6 +52,7 @@ runs:
4752
pip3 install -r dragonfly/requirements.txt
4853
# used by PyTests
4954
export DRAGONFLY_PATH="${GITHUB_WORKSPACE}/${{inputs.build-folder-name}}/${{inputs.dfly-executable}}"
55+
export ROOT_DIR="${GITHUB_WORKSPACE}/tests/dragonfly/valkey_search"
5056
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 # to crash on errors
5157
5258
if [[ "${{inputs.epoll}}" == 'epoll' ]]; then

tests/dragonfly/valkey_search/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ tests/dragonfly/valkey_search/
5757
3. **Mock framework** (`__init__.py`) replaces valkey-search imports with Dragonfly equivalents
5858
4. **Adapter** (`valkey_search_test_case_dragonfly.py`) creates real Dragonfly instances with replicas
5959
5. **Original tests run unchanged** - all adaptation happens in infrastructure layer
60+
6. **Python 3.8 compatibility** - sync script patches all `.py` files to add `from __future__ import annotations`

tests/dragonfly/valkey_search/conftest.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,60 @@
22
Pytest configuration for valkey-search tests on Dragonfly
33
"""
44

5+
import pytest
56
from .. import dfly_args
67

78

9+
# List of tests to skip - add test node IDs here
10+
# Example format: "integration/test_file.py::TestClass::test_method"
11+
SKIP_TESTS = [
12+
"integration/compatibility_test.py::TestAnswersCMD::test_answers",
13+
"integration/test_cancel.py::TestCancelCMD::test_timeoutCMD",
14+
"integration/test_cancel.py::TestCancelCME::test_timeoutCME",
15+
"integration/test_eviction.py::TestEviction::test_eviction_with_search_index",
16+
"integration/test_fanout_base.py::TestFanoutBase::test_fanout_retry",
17+
"integration/test_fanout_base.py::TestFanoutBase::test_fanout_shutdown",
18+
"integration/test_fanout_base.py::TestFanoutBase::test_fanout_timeout",
19+
"integration/test_flushall.py::TestFlushAllCME::test_flushallCME",
20+
"integration/test_ft_create_consistency.py::TestFTCreateConsistency::test_create_force_index_name_error_retry",
21+
"integration/test_ft_create_consistency.py::TestFTCreateConsistency::test_duplicate_creation",
22+
"integration/test_ft_create_consistency.py::TestFTCreateConsistency::test_concurrent_creation",
23+
"integration/test_ft_create_consistency.py::TestFTCreateConsistency::test_create_timeout",
24+
"integration/test_ft_dropindex_consistency.py::TestFTDropindexConsistency::test_dropindex_synchronize_handle_message_first",
25+
"integration/test_ft_dropindex_consistency.py::TestFTDropindexConsistency::test_dropindex_synchronize_consistency_check_first",
26+
"integration/test_info.py::TestVSSBasic::test_info_fields_present",
27+
"integration/test_info_cluster.py::TestFTInfoCluster::test_ft_info_cluster_success",
28+
"integration/test_info_cluster.py::TestFTInfoCluster::test_ft_info_cluster_force_index_name_error_retry",
29+
"integration/test_info_cluster.py::TestFTInfoCluster::test_ft_info_cluster_retry",
30+
"integration/test_info_primary.py::TestFTInfoPrimary::test_ft_info_primary_success",
31+
"integration/test_info_primary.py::TestFTInfoPrimary::test_ft_info_primary_force_index_name_error_retry",
32+
"integration/test_info_primary.py::TestFTInfoPrimary::test_ft_info_primary_retry",
33+
"integration/test_oom_handling.py::TestSearchOOMHandlingCME::test_search_oom_cme",
34+
"integration/test_oom_handling.py::TestSearchOOMHandlingCMD::test_search_oom_cmd",
35+
"integration/test_query_parser.py::TestQueryParser::test_query_string_bytes_limit",
36+
"integration/test_query_parser.py::TestQueryParser::test_query_string_depth_limit",
37+
"integration/test_query_parser.py::TestQueryParser::test_query_string_terms_count_limit",
38+
"integration/test_reclaimable_memory.py::TestReclaimableMemory::test_reclaimable_memory_with_vector_operations",
39+
"integration/test_reclaimable_memory.py::TestReclaimableMemory::test_reclaimable_memory_multiple_indexes",
40+
"integration/test_skip_index_load.py::TestRDBCorruptedIndex::test_corrupted_rdb_skip_index_load_succeeds",
41+
"integration/test_valkey_search_acl.py::TestCommandsACLs::test_acl_specific_search_commands_permissions",
42+
"integration/test_valkey_search_acl.py::TestCommandsACLs::test_index_with_several_prefixes_permissions",
43+
"integration/test_valkey_search_acl.py::TestCommandsACLs::test_valkey_search_cmds_categories",
44+
]
45+
46+
847
# Apply dfly_args to all test classes in this directory
948
def pytest_collection_modifyitems(items):
10-
"""Apply dfly_args decorator to all test classes"""
49+
"""Apply dfly_args decorator to all test classes and skip marked tests"""
1150
for item in items:
1251
if item.cls and not hasattr(item.cls, "_dfly_args_applied"):
1352
# Apply the decorator to the class
1453
decorated_class = dfly_args({"proactor_threads": 4})(item.cls)
1554
item.cls._dfly_args_applied = True
55+
56+
# Skip tests that are in the skip list
57+
# Get the relative path from valkey_search directory
58+
item_path = str(item.nodeid)
59+
for skip_pattern in SKIP_TESTS:
60+
if skip_pattern in item_path:
61+
item.add_marker(pytest.mark.skip(reason=f"Test skipped: {skip_pattern}"))

tests/dragonfly/valkey_search/sync-valkey-search-tests.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,43 @@ INTEGRATION_DIR="$SCRIPT_DIR/integration"
66
VALKEY_SEARCH_REPO="https://github.com/valkey-io/valkey-search.git"
77
TEMP_DIR=$(mktemp -d)
88

9-
echo "Syncing valkey-search tests..."
9+
# Accept optional tag/revision parameter
10+
TAG_OR_REV="${1:-}"
11+
12+
if [ -n "$TAG_OR_REV" ]; then
13+
echo "Syncing valkey-search tests from tag/revision: $TAG_OR_REV"
14+
else
15+
echo "Syncing valkey-search tests from latest commit..."
16+
fi
1017

1118
# Remove old integration directory
1219
rm -rf "$INTEGRATION_DIR"
1320

1421
# Clone to temp directory
15-
git clone --depth=1 "$VALKEY_SEARCH_REPO" "$TEMP_DIR" >/dev/null 2>&1
22+
if [ -n "$TAG_OR_REV" ]; then
23+
# Clone with full history and checkout specific tag/revision
24+
git clone "$VALKEY_SEARCH_REPO" "$TEMP_DIR" >/dev/null 2>&1
25+
pushd "$TEMP_DIR" >/dev/null
26+
git checkout "$TAG_OR_REV" >/dev/null 2>&1
27+
popd >/dev/null
28+
else
29+
# Clone only the latest commit (shallow clone)
30+
git clone --depth=1 "$VALKEY_SEARCH_REPO" "$TEMP_DIR" >/dev/null 2>&1
31+
fi
1632

1733
# Copy integration directory
1834
cp -r "$TEMP_DIR/integration" "$INTEGRATION_DIR"
1935

36+
# Patch all Python files for Python 3.8 compatibility
37+
# Add 'from __future__ import annotations' to support modern type hints
38+
echo "Patching Python files for Python 3.8 compatibility..."
39+
find "$INTEGRATION_DIR" -name "*.py" -type f | while read -r file; do
40+
# Check if the file doesn't already have 'from __future__ import annotations'
41+
if ! grep -q "from __future__ import annotations" "$file"; then
42+
sed -i '1i from __future__ import annotations' "$file"
43+
fi
44+
done
45+
2046
# Cleanup
2147
rm -rf "$TEMP_DIR"
2248

tests/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ log_date_format = %Y-%m-%d %H:%M:%S
55
log_file_level=DEBUG
66
log_cli = true
77
asyncio_mode=auto
8-
addopts = -ra --emoji --ignore=dragonfly/valkey_search
8+
addopts = -ra --emoji
99
markers =
1010
# Slow tests that take some time to complete but are run both as part of the
1111
# regression-test *and* ci *and* release workflows.

0 commit comments

Comments
 (0)