Skip to content

Commit 2924dfa

Browse files
add back postgres
1 parent 5bebd3b commit 2924dfa

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

.github/workflows/integration-test-workflow-debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
POSTGRES_PORT: 5432
2121
POSTGRES_PASSWORD: postgres
2222
POSTGRES_USER: postgres
23+
R2R_PROJECT_NAME: r2r_default
2324
steps:
2425
- name: Install and configure PostgreSQL
2526
run: |

py/core/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"PipeType",
131131
## PROVIDERS
132132
# Base provider classes
133+
"AppConfig",
133134
"Provider",
134135
"ProviderConfig",
135136
# Auth provider

py/core/base/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"PipeType",
104104
## PROVIDERS
105105
# Base provider classes
106+
"AppConfig",
106107
"Provider",
107108
"ProviderConfig",
108109
# Auth provider

py/tests/conftest.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77

88
from core import (
9+
AppConfig,
910
AuthConfig,
1011
BCryptConfig,
1112
CompletionConfig,
@@ -59,32 +60,35 @@ def generate_random_vector_entry(
5960
generate_random_vector_entry(i, dimension) for i in range(num_entries)
6061
]
6162

63+
@pytest.fixture(scope="session")
64+
def app_config():
65+
return AppConfig()
6266

6367
# Crypto
6468
@pytest.fixture(scope="session")
65-
def crypto_config():
66-
return BCryptConfig()
69+
def crypto_config(app_config):
70+
return BCryptConfig(app=app_config)
6771

6872

6973
@pytest.fixture(scope="session")
70-
def crypto_provider(crypto_config):
74+
def crypto_provider(crypto_config, app_config):
7175
return BCryptProvider(crypto_config)
7276

7377

7478
# Postgres
7579
@pytest.fixture(scope="session")
76-
def db_config():
80+
def db_config(app_config):
7781
collection_id = uuid.uuid4()
7882

7983
random_project_name = f"test_collection_{collection_id.hex}"
8084
return DatabaseConfig.create(
81-
provider="postgres", project_name=random_project_name
85+
provider="postgres", project_name=random_project_name, app=app_config
8286
)
8387

8488

8589
@pytest.fixture(scope="function")
8690
async def postgres_db_provider(
87-
db_config, dimension, crypto_provider, sample_entries
91+
db_config, dimension, crypto_provider, sample_entries, app_config
8892
):
8993
db = PostgresDBProvider(
9094
db_config, dimension=dimension, crypto_provider=crypto_provider
@@ -98,12 +102,12 @@ async def postgres_db_provider(
98102

99103

100104
@pytest.fixture(scope="function")
101-
def db_config_temporary():
105+
def db_config_temporary(app_config):
102106
collection_id = uuid.uuid4()
103107

104108
random_project_name = f"test_collection_{collection_id.hex}"
105109
return DatabaseConfig.create(
106-
provider="postgres", project_name=random_project_name
110+
provider="postgres", project_name=random_project_name, app=app_config
107111
)
108112

109113

@@ -127,12 +131,13 @@ async def temporary_postgres_db_provider(
127131

128132
# Auth
129133
@pytest.fixture(scope="session")
130-
def auth_config():
134+
def auth_config(app_config):
131135
return AuthConfig(
132136
secret_key="test_secret_key",
133137
access_token_lifetime_in_minutes=15,
134138
refresh_token_lifetime_in_days=1,
135139
require_email_verification=False,
140+
app=app_config
136141
)
137142

138143

@@ -149,19 +154,20 @@ async def r2r_auth_provider(
149154

150155
# Embeddings
151156
@pytest.fixture
152-
def litellm_provider():
157+
def litellm_provider(app_config):
153158
config = EmbeddingConfig(
154159
provider="litellm",
155160
base_model="text-embedding-3-small",
156161
base_dimension=1536,
162+
app=app_config
157163
)
158164
return LiteLLMEmbeddingProvider(config)
159165

160166

161167
# File Provider
162168
@pytest.fixture(scope="function")
163-
def file_config():
164-
return FileConfig(provider="postgres")
169+
def file_config(app_config):
170+
return FileConfig(provider="postgres", app=app_config)
165171

166172

167173
@pytest.fixture(scope="function")
@@ -176,18 +182,18 @@ async def postgres_file_provider(file_config, temporary_postgres_db_provider):
176182

177183
# LLM provider
178184
@pytest.fixture
179-
def litellm_completion_provider():
180-
config = CompletionConfig(provider="litellm")
185+
def litellm_completion_provider(app_config):
186+
config = CompletionConfig(provider="litellm", app=app_config)
181187
return LiteCompletionProvider(config)
182188

183189

184190
# Logging
185191
@pytest.fixture(scope="function")
186-
async def local_logging_provider():
192+
async def local_logging_provider(app_config):
187193
unique_id = str(uuid.uuid4())
188194
logging_path = f"test_{unique_id}.sqlite"
189195
provider = LocalRunLoggingProvider(
190-
LoggingConfig(logging_path=logging_path)
196+
LoggingConfig(logging_path=logging_path, app=app_config)
191197
)
192198
await provider._init()
193199
yield provider

0 commit comments

Comments
 (0)