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

Implement Docker Compose Setup and Test Execution Script #28

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3.8'
services:
qdrant:
image: qdrant/qdrant
ports:
- 6333:6333
- 6334:6334
environment:
- QDRANT__SERVICE__GRPC_PORT=6334

tests:
image: rust:1.73.0-bullseye
command: bash -c "cargo test --features qdrant --package prompt-graph-core --package prompt-graph-exec --package chidori"
volumes:
- ./toolchain:/usr/src/toolchain
working_dir: /usr/src/toolchain
depends_on:
- qdrant
28 changes: 28 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better located in /toolchain/scripts for consistency, and could be named run_qdrant_tests.sh. The other scripts there have a pattern for executing from the root of the repo as their cwd.


# Check if Docker is installed
if ! command -v docker &> /dev/null
then
echo "Docker is not installed. Please install Docker and try again."
exit 1
fi

# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null
then
echo "Docker Compose is not installed. Please install Docker Compose and try again."
exit 1
fi

# Check if the --build flag was provided
if [[ $* == *--build* ]]
then
# Rebuild the Docker images
docker-compose build
fi

# Start the Docker Compose services and run the tests
docker-compose up --exit-code-from tests

# Tear down the Docker Compose services
docker-compose down
16 changes: 14 additions & 2 deletions toolchain/prompt-graph-exec/src/runtime_nodes/node_memory/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,27 @@ mod tests {
#[cfg(feature = "qdrant")]
#[tokio::test]
async fn test_exec_memory_node_qdrant() {
// TODO: this test will require a running qdrant instance

// to run the test with qdrant, run the following command
// go to the root of the project and run
// 1. chmod +x ./run-tests.sh
// 2. ./run-tests.sh --build for the first time
// 3. ./run-tests.sh if you have already built the container

// this runs the qdrant container and runs the tests

// but if you wish to run the tests manually follow the steps below.
// 1. run the qdrant container

// docker run -p 6333:6333 -p 6334:6334 \
// -e QDRANT__SERVICE__GRPC_PORT="6334" \
// qdrant/qdrant

// 2. change the qdrant url from qdrant to localhost
// Change from QdrantClientConfig::from_url("http://qdrant:6334") to QdrantClientConfig::from_url("http://localhost:6334")
let db = SledConfig::new().temporary(true).flush_every_ms(None).open().unwrap();
let tree = db.open_tree("test").unwrap();
let config = QdrantClientConfig::from_url("http://localhost:6334");
let config = QdrantClientConfig::from_url("http://qdrant:6334");
let client = QdrantClient::new(Some(config)).unwrap();
let _ = client.delete_collection("test_exec_memory_node_qdrant").await;

Expand Down