mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-25 05:01:01 +02:00
Fix tests
This commit is contained in:
parent
233fb4fad2
commit
9dfdef0110
11 changed files with 30 additions and 30 deletions
|
|
@ -107,7 +107,7 @@ class TestEndToEndConfigurationFlow:
|
||||||
# Verify KnowledgeTableStore was created with env config
|
# Verify KnowledgeTableStore was created with env config
|
||||||
mock_table_store.assert_called_once_with(
|
mock_table_store.assert_called_once_with(
|
||||||
cassandra_host=['kg-host1', 'kg-host2', 'kg-host3', 'kg-host4'],
|
cassandra_host=['kg-host1', 'kg-host2', 'kg-host3', 'kg-host4'],
|
||||||
cassandra_user='kg-user',
|
cassandra_username='kg-user',
|
||||||
cassandra_password='kg-pass',
|
cassandra_password='kg-pass',
|
||||||
keyspace='knowledge'
|
keyspace='knowledge'
|
||||||
)
|
)
|
||||||
|
|
@ -177,9 +177,9 @@ class TestConfigurationPriorityEndToEnd:
|
||||||
|
|
||||||
# Verify mixed configuration
|
# Verify mixed configuration
|
||||||
mock_table_store.assert_called_once_with(
|
mock_table_store.assert_called_once_with(
|
||||||
cassandra_host=['partial-host'], # From parameter
|
cassandra_host=['partial-host'], # From parameter
|
||||||
cassandra_user='fallback-user', # From environment
|
cassandra_username='fallback-user', # From environment
|
||||||
cassandra_password='fallback-pass', # From environment
|
cassandra_password='fallback-pass', # From environment
|
||||||
keyspace='knowledge'
|
keyspace='knowledge'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -269,7 +269,7 @@ class TestNoBackwardCompatibilityEndToEnd:
|
||||||
# cassandra_user should be ignored, only cassandra_username works
|
# cassandra_user should be ignored, only cassandra_username works
|
||||||
mock_table_store.assert_called_once_with(
|
mock_table_store.assert_called_once_with(
|
||||||
cassandra_host=['legacy-kg-host'],
|
cassandra_host=['legacy-kg-host'],
|
||||||
cassandra_user=None, # Should be None since cassandra_user is not recognized
|
cassandra_username=None, # Should be None since cassandra_user is not recognized
|
||||||
cassandra_password='legacy-kg-pass',
|
cassandra_password='legacy-kg-pass',
|
||||||
keyspace='knowledge'
|
keyspace='knowledge'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,13 @@ class Configuration:
|
||||||
|
|
||||||
# FIXME: Some version vs config race conditions
|
# FIXME: Some version vs config race conditions
|
||||||
|
|
||||||
def __init__(self, push, host, user, password, keyspace):
|
def __init__(self, push, host, username, password, keyspace):
|
||||||
|
|
||||||
# External function to respond to update
|
# External function to respond to update
|
||||||
self.push = push
|
self.push = push
|
||||||
|
|
||||||
self.table_store = ConfigTableStore(
|
self.table_store = ConfigTableStore(
|
||||||
host, user, password, keyspace
|
host, username, password, keyspace
|
||||||
)
|
)
|
||||||
|
|
||||||
async def inc_version(self):
|
async def inc_version(self):
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class Processor(AsyncProcessor):
|
||||||
)
|
)
|
||||||
|
|
||||||
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
||||||
cassandra_user = params.get("cassandra_user")
|
cassandra_username = params.get("cassandra_username")
|
||||||
cassandra_password = params.get("cassandra_password")
|
cassandra_password = params.get("cassandra_password")
|
||||||
|
|
||||||
id = params.get("id")
|
id = params.get("id")
|
||||||
|
|
@ -77,7 +77,7 @@ class Processor(AsyncProcessor):
|
||||||
"flow_request_schema": FlowRequest.__name__,
|
"flow_request_schema": FlowRequest.__name__,
|
||||||
"flow_response_schema": FlowResponse.__name__,
|
"flow_response_schema": FlowResponse.__name__,
|
||||||
"cassandra_host": cassandra_host,
|
"cassandra_host": cassandra_host,
|
||||||
"cassandra_user": cassandra_user,
|
"cassandra_username": cassandra_username,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ class Processor(AsyncProcessor):
|
||||||
|
|
||||||
self.config = Configuration(
|
self.config = Configuration(
|
||||||
host = cassandra_host.split(","),
|
host = cassandra_host.split(","),
|
||||||
user = cassandra_user,
|
username = cassandra_username,
|
||||||
password = cassandra_password,
|
password = cassandra_password,
|
||||||
keyspace = keyspace,
|
keyspace = keyspace,
|
||||||
push = self.push
|
push = self.push
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@ logger = logging.getLogger(__name__)
|
||||||
class KnowledgeManager:
|
class KnowledgeManager:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, cassandra_host, cassandra_user, cassandra_password,
|
self, cassandra_host, cassandra_username, cassandra_password,
|
||||||
keyspace, flow_config,
|
keyspace, flow_config,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.table_store = KnowledgeTableStore(
|
self.table_store = KnowledgeTableStore(
|
||||||
cassandra_host, cassandra_user, cassandra_password, keyspace
|
cassandra_host, cassandra_username, cassandra_password, keyspace
|
||||||
)
|
)
|
||||||
|
|
||||||
self.loader_queue = asyncio.Queue(maxsize=20)
|
self.loader_queue = asyncio.Queue(maxsize=20)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class Processor(AsyncProcessor):
|
||||||
)
|
)
|
||||||
|
|
||||||
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
||||||
cassandra_user = params.get("cassandra_user")
|
cassandra_username = params.get("cassandra_username")
|
||||||
cassandra_password = params.get("cassandra_password")
|
cassandra_password = params.get("cassandra_password")
|
||||||
|
|
||||||
super(Processor, self).__init__(
|
super(Processor, self).__init__(
|
||||||
|
|
@ -90,7 +90,7 @@ class Processor(AsyncProcessor):
|
||||||
|
|
||||||
self.knowledge = KnowledgeManager(
|
self.knowledge = KnowledgeManager(
|
||||||
cassandra_host = cassandra_host.split(","),
|
cassandra_host = cassandra_host.split(","),
|
||||||
cassandra_user = cassandra_user,
|
cassandra_username = cassandra_username,
|
||||||
cassandra_password = cassandra_password,
|
cassandra_password = cassandra_password,
|
||||||
keyspace = keyspace,
|
keyspace = keyspace,
|
||||||
flow_config = self,
|
flow_config = self,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class Librarian:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cassandra_host, cassandra_user, cassandra_password,
|
cassandra_host, cassandra_username, cassandra_password,
|
||||||
minio_host, minio_access_key, minio_secret_key,
|
minio_host, minio_access_key, minio_secret_key,
|
||||||
bucket_name, keyspace, load_document,
|
bucket_name, keyspace, load_document,
|
||||||
):
|
):
|
||||||
|
|
@ -26,7 +26,7 @@ class Librarian:
|
||||||
)
|
)
|
||||||
|
|
||||||
self.table_store = LibraryTableStore(
|
self.table_store = LibraryTableStore(
|
||||||
cassandra_host, cassandra_user, cassandra_password, keyspace
|
cassandra_host, cassandra_username, cassandra_password, keyspace
|
||||||
)
|
)
|
||||||
|
|
||||||
self.load_document = load_document
|
self.load_document = load_document
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class Processor(AsyncProcessor):
|
||||||
)
|
)
|
||||||
|
|
||||||
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
cassandra_host = params.get("cassandra_host", default_cassandra_host)
|
||||||
cassandra_user = params.get("cassandra_user")
|
cassandra_username = params.get("cassandra_username")
|
||||||
cassandra_password = params.get("cassandra_password")
|
cassandra_password = params.get("cassandra_password")
|
||||||
|
|
||||||
super(Processor, self).__init__(
|
super(Processor, self).__init__(
|
||||||
|
|
@ -77,7 +77,7 @@ class Processor(AsyncProcessor):
|
||||||
"minio_host": minio_host,
|
"minio_host": minio_host,
|
||||||
"minio_access_key": minio_access_key,
|
"minio_access_key": minio_access_key,
|
||||||
"cassandra_host": cassandra_host,
|
"cassandra_host": cassandra_host,
|
||||||
"cassandra_user": cassandra_user,
|
"cassandra_username": cassandra_username,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ class Processor(AsyncProcessor):
|
||||||
|
|
||||||
self.librarian = Librarian(
|
self.librarian = Librarian(
|
||||||
cassandra_host = cassandra_host.split(","),
|
cassandra_host = cassandra_host.split(","),
|
||||||
cassandra_user = cassandra_user,
|
cassandra_username = cassandra_username,
|
||||||
cassandra_password = cassandra_password,
|
cassandra_password = cassandra_password,
|
||||||
minio_host = minio_host,
|
minio_host = minio_host,
|
||||||
minio_access_key = minio_access_key,
|
minio_access_key = minio_access_key,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class Processor(FlowProcessor):
|
||||||
# Use helper to resolve configuration
|
# Use helper to resolve configuration
|
||||||
hosts, username, password = resolve_cassandra_config(
|
hosts, username, password = resolve_cassandra_config(
|
||||||
host=params.get("cassandra_host"),
|
host=params.get("cassandra_host"),
|
||||||
username=params.get("cassandra_user", params.get("cassandra_username")),
|
username=params.get("cassandra_username"),
|
||||||
password=params.get("cassandra_password")
|
password=params.get("cassandra_password")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ class Processor(FlowProcessor):
|
||||||
|
|
||||||
self.table_store = KnowledgeTableStore(
|
self.table_store = KnowledgeTableStore(
|
||||||
cassandra_host = hosts,
|
cassandra_host = hosts,
|
||||||
cassandra_user = username,
|
cassandra_username = username,
|
||||||
cassandra_password = password,
|
cassandra_password = password,
|
||||||
keyspace = keyspace,
|
keyspace = keyspace,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class ConfigTableStore:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cassandra_host, cassandra_user, cassandra_password, keyspace,
|
cassandra_host, cassandra_username, cassandra_password, keyspace,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.keyspace = keyspace
|
self.keyspace = keyspace
|
||||||
|
|
@ -28,10 +28,10 @@ class ConfigTableStore:
|
||||||
if isinstance(cassandra_host, str):
|
if isinstance(cassandra_host, str):
|
||||||
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
||||||
|
|
||||||
if cassandra_user and cassandra_password:
|
if cassandra_username and cassandra_password:
|
||||||
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
||||||
auth_provider = PlainTextAuthProvider(
|
auth_provider = PlainTextAuthProvider(
|
||||||
username=cassandra_user, password=cassandra_password
|
username=cassandra_username, password=cassandra_password
|
||||||
)
|
)
|
||||||
self.cluster = Cluster(
|
self.cluster = Cluster(
|
||||||
cassandra_host,
|
cassandra_host,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class KnowledgeTableStore:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cassandra_host, cassandra_user, cassandra_password, keyspace,
|
cassandra_host, cassandra_username, cassandra_password, keyspace,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.keyspace = keyspace
|
self.keyspace = keyspace
|
||||||
|
|
@ -28,10 +28,10 @@ class KnowledgeTableStore:
|
||||||
if isinstance(cassandra_host, str):
|
if isinstance(cassandra_host, str):
|
||||||
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
||||||
|
|
||||||
if cassandra_user and cassandra_password:
|
if cassandra_username and cassandra_password:
|
||||||
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
||||||
auth_provider = PlainTextAuthProvider(
|
auth_provider = PlainTextAuthProvider(
|
||||||
username=cassandra_user, password=cassandra_password
|
username=cassandra_username, password=cassandra_password
|
||||||
)
|
)
|
||||||
self.cluster = Cluster(
|
self.cluster = Cluster(
|
||||||
cassandra_host,
|
cassandra_host,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class LibraryTableStore:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cassandra_host, cassandra_user, cassandra_password, keyspace,
|
cassandra_host, cassandra_username, cassandra_password, keyspace,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.keyspace = keyspace
|
self.keyspace = keyspace
|
||||||
|
|
@ -32,10 +32,10 @@ class LibraryTableStore:
|
||||||
if isinstance(cassandra_host, str):
|
if isinstance(cassandra_host, str):
|
||||||
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
cassandra_host = [h.strip() for h in cassandra_host.split(',')]
|
||||||
|
|
||||||
if cassandra_user and cassandra_password:
|
if cassandra_username and cassandra_password:
|
||||||
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
||||||
auth_provider = PlainTextAuthProvider(
|
auth_provider = PlainTextAuthProvider(
|
||||||
username=cassandra_user, password=cassandra_password
|
username=cassandra_username, password=cassandra_password
|
||||||
)
|
)
|
||||||
self.cluster = Cluster(
|
self.cluster = Cluster(
|
||||||
cassandra_host,
|
cassandra_host,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue