Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test framework #20

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ you can run the test with `--strategy=TestRunner=local`, e.g.:
bazel test //testing:ft_search_test --strategy=TestRunner=local --run_under=/some/path/foobar.sh
```

### Integration Testing

To run any integration tests, you will need to have a local build of both valkey-server and valkey-cli. You can retrieve these by downloading the [Valkey source code and building it locally](https://github.com/valkey-io/valkey/).

Once you have downloaded and built Valkey, you can run the integration tests:

```
bazel test //testing/integration:vector_search_integration_test --test_arg=--valkey_server_path=/path/to/valkey-server --test_arg=--valkey_cli_path=/path/to/valkey-cli
```

Additionally, it is recommended to run the stability test suite, which requires a local build of [Memtier](https://github.com/RedisLabs/memtier_benchmark):

```
bazel test //testing/integration:stability_test --test_arg=--valkey_server_path=/path/to/valkey-server --test_arg=--valkey_cli_path=/path/to/valkey-cli --test_arg=--memtier_path=/path/to/memtier_benchmark --test_output=streamed
```

## Loading

ValkeySearch is compatible with any version of Valkey and can also be loaded into Redis versions 7.0 and 7.2. To load the module, execute the following command:
Expand Down
19 changes: 19 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module(
name = "io_valkey_valkeysearch",
version = "1.0.0",
)

bazel_dep(name = "protoc-gen-validate", version = "1.0.4.bcr.2")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "abseil-cpp", version = "20240722.0.bcr.1", repo_name = "com_google_absl")
bazel_dep(name = "protobuf", version = "29.2", repo_name = "com_google_protobuf")
Expand Down Expand Up @@ -37,3 +39,20 @@ git_override(
# Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main).
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
)

# Integration test dependencies
bazel_dep(name = "rules_python", version = "0.40.0", dev_dependency = True)
python = use_extension(
"@rules_python//python/extensions:python.bzl",
"python",
dev_dependency = True
)
python.toolchain(python_version = "3.12", is_default=True)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
pip.parse(
hub_name = "pip",
requirements_lock = "//testing/integration:requirements.txt",
python_version = "3.12"
)
use_repo(pip, "pip")
53 changes: 53 additions & 0 deletions testing/integration/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
load("@pip//:requirements.bzl", "requirement")

package(
default_applicable_licenses=["//:license"],
default_visibility=["//testing:__subpackages__"],
)

py_test(
name="stability_test",
srcs=["stability_test.py"],
deps=[
":stability_runner",
":utils",
requirement("valkey"),
requirement("absl-py"),
],
data=[
"//src:valkeysearch",
],
timeout="eternal", # 3600 seconds, for slow machines
)

py_test(
name="vector_search_integration_test",
srcs=["vector_search_integration_test.py"],
deps=[
":utils",
requirement("valkey"),
requirement("absl-py"),
requirement("numpy"),
],
data=[
"//src:valkeysearch",
],
)

py_library(
name="stability_runner",
srcs=["stability_runner.py"],
deps=[
":utils",
requirement("valkey"),
],
)

py_library(
name="utils",
srcs=["utils.py"],
deps=[
requirement("valkey"),
requirement("numpy"),
],
)
3 changes: 3 additions & 0 deletions testing/integration/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
valkey==6.0.2
absl-py==2.1.0
numpy==2.2.2
Loading
Loading