File tree Expand file tree Collapse file tree 6 files changed +83
-2
lines changed
langchain/tests/integration_tests
tests-utils/ragstack_tests_utils Expand file tree Collapse file tree 6 files changed +83
-2
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,9 @@ jobs:
147
147
if [[ "true" == "${{ needs.preconditions.outputs.libs_colbert }}" ]]; then
148
148
run_itests libs/colbert
149
149
fi
150
+ if [[ "true" == "${{ needs.preconditions.outputs.libs_knowledge_store }}" ]]; then
151
+ run_itests libs/knowledge-store
152
+ fi
150
153
if [[ "true" == "${{ needs.preconditions.outputs.libs_langchain }}" ]]; then
151
154
run_itests libs/langchain
152
155
fi
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ documentation = "https://docs.datastax.com/en/ragstack"
10
10
packages = [{ include = " ragstack_knowledge_store" }]
11
11
12
12
[tool .poetry .dependencies ]
13
- python = " >=3.8.1,<4.0 "
13
+ python = " >=3.9,<3.13 "
14
14
cassio = " ^0.1.7"
15
15
16
16
[tool .poetry .group .dev .dependencies ]
@@ -29,6 +29,10 @@ numpy = [
29
29
{version = " >1.26.0,<2" , python = " >=3.12" }
30
30
]
31
31
32
+ [tool .poetry .group .test .dependencies ]
33
+ ragstack-ai-langchain = { path = " ../langchain" , develop = true }
34
+ ragstack-ai-tests-utils = { path = " ../tests-utils" , develop = true }
35
+
32
36
[build-system ]
33
37
requires = [" poetry-core" ]
34
38
build-backend = " poetry.core.masonry.api"
Original file line number Diff line number Diff line change
1
+ import secrets
2
+ from typing import Iterator
3
+
4
+ import pytest
5
+ from dotenv import load_dotenv
6
+ from langchain_openai import OpenAIEmbeddings
7
+ from ragstack_knowledge_store .graph_store import GraphStore
8
+ from ragstack_tests_utils import LocalCassandraTestStore
9
+
10
+ load_dotenv ()
11
+
12
+ KEYSPACE = "default_keyspace"
13
+
14
+
15
+ @pytest .fixture (scope = "session" )
16
+ def cassandra () -> Iterator [LocalCassandraTestStore ]:
17
+ store = LocalCassandraTestStore ()
18
+ yield store
19
+
20
+ if store .docker_container :
21
+ store .docker_container .stop ()
22
+
23
+
24
+ @pytest .fixture
25
+ def graph_store_factory (cassandra : LocalCassandraTestStore ):
26
+ session = cassandra .create_cassandra_session ()
27
+ session .set_keyspace (KEYSPACE )
28
+
29
+ embedding = OpenAIEmbeddings ()
30
+
31
+ def _make_graph_store ():
32
+ name = secrets .token_hex (8 )
33
+
34
+ node_table = f"nodes_{ name } "
35
+ targets_table = f"targets_{ name } "
36
+ return GraphStore (
37
+ embedding ,
38
+ session = session ,
39
+ keyspace = KEYSPACE ,
40
+ node_table = node_table ,
41
+ targets_table = targets_table ,
42
+ )
43
+
44
+ yield _make_graph_store
45
+
46
+ session .shutdown ()
47
+
48
+
49
+ def test_graph_store_creation (graph_store_factory ):
50
+ """Test that a graph store can be created.
51
+
52
+ This verifies the schema can be applied and the queries prepared.
53
+ """
54
+ graph_store_factory ()
Original file line number Diff line number Diff line change @@ -11,4 +11,15 @@ pass_env =
11
11
commands =
12
12
poetry install
13
13
poetry build
14
- poetry run pytest --disable-warnings {toxinidir}/tests
14
+ poetry run pytest --disable-warnings {toxinidir}/tests/unit_tests
15
+
16
+ [testenv:integration-tests]
17
+ description = run integration tests
18
+ deps =
19
+ poetry
20
+ pass_env =
21
+ OPENAI_API_KEY
22
+ commands =
23
+ poetry install
24
+ poetry build
25
+ poetry run pytest --disable-warnings {toxinidir}/tests/integration_tests
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def get_astradb_test_store() -> AstraDBTestStore:
26
26
@pytest .fixture (scope = "session" , autouse = True )
27
27
def before_after_tests ():
28
28
yield
29
+
29
30
if (
30
31
status ["local_cassandra_test_store" ]
31
32
and status ["local_cassandra_test_store" ].docker_container
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ def __init__(
12
12
super ().__init__ (image = image , ** kwargs )
13
13
self .port = port
14
14
15
+ self .with_env (
16
+ "JVM_OPTS" ,
17
+ "-Dcassandra.skip_wait_for_gossip_to_settle=0 -Dcassandra.initial_token=0" ,
18
+ )
19
+ self .with_env ("HEAP_NEWSIZE" , "128M" )
20
+ self .with_env ("MAX_HEAP_SIZE" , "1024M" )
21
+ self .with_env ("CASSANDRA_ENDPOINT_SNITCH" , "GossipingPropertyFileSnitch" )
22
+ self .with_env ("CASSANDRA_DC" , "datacenter1" )
15
23
self .with_exposed_ports (self .port )
16
24
17
25
def _configure (self ):
You can’t perform that action at this time.
0 commit comments