Skip to content

Commit 255072d

Browse files
authored
refactor: move dC tests to their own module and job (#3529)
* move dC tests to their own module and job * restore global var * revert
1 parent 815017a commit 255072d

File tree

5 files changed

+452
-457
lines changed

5 files changed

+452
-457
lines changed

.github/workflows/tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,33 @@ jobs:
224224
channel: '#haystack'
225225
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
226226

227+
integration-tests-dc:
228+
name: Integration / dC / ${{ matrix.os }}
229+
needs:
230+
- unit-tests
231+
strategy:
232+
fail-fast: false
233+
matrix:
234+
os: [ubuntu-latest,macos-latest,windows-latest]
235+
runs-on: ${{ matrix.os }}
236+
steps:
237+
- uses: actions/checkout@v3
238+
239+
- name: Setup Python
240+
uses: ./.github/actions/python_cache/
241+
242+
- name: Install Haystack
243+
run: pip install -U .
244+
245+
- name: Run tests
246+
run: |
247+
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_deepsetcloud.py
248+
249+
- uses: act10ns/slack@v1
250+
with:
251+
status: ${{ job.status }}
252+
channel: '#haystack'
253+
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
227254
#
228255
# TODO: the following steps need to be revisited
229256
#

conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ def pytest_addoption(parser):
44
action="store",
55
default="elasticsearch, faiss, sql, memory, milvus1, milvus, weaviate, pinecone",
66
)
7+
parser.addoption(
8+
"--mock-dc", action="store_true", default=True, help="Mock HTTP requests to dC while running tests"
9+
)
710

811

912
def pytest_generate_tests(metafunc):

test/conftest.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from haystack import Answer, BaseComponent
2727
from haystack.document_stores import (
2828
BaseDocumentStore,
29-
DeepsetCloudDocumentStore,
3029
InMemoryDocumentStore,
3130
ElasticsearchDocumentStore,
3231
WeaviateDocumentStore,
@@ -86,11 +85,7 @@
8685

8786
# To manually run the tests with default PostgreSQL instead of SQLite, switch the lines below
8887
SQL_TYPE = "sqlite"
89-
# SQL_TYPE = "postgres"
90-
9188
SAMPLES_PATH = Path(__file__).parent / "samples"
92-
93-
# to run tests against Deepset Cloud set MOCK_DC to False and set the following params
9489
DC_API_ENDPOINT = "https://DC_API/v1"
9590
DC_TEST_INDEX = "document_retrieval_1"
9691
DC_API_KEY = "NO_KEY"
@@ -603,12 +598,6 @@ def deepset_cloud_fixture():
603598
responses.add_passthru(DC_API_ENDPOINT)
604599

605600

606-
@pytest.fixture
607-
@responses.activate
608-
def deepset_cloud_document_store(deepset_cloud_fixture):
609-
return DeepsetCloudDocumentStore(api_endpoint=DC_API_ENDPOINT, api_key=DC_API_KEY, index=DC_TEST_INDEX)
610-
611-
612601
@pytest.fixture
613602
def rag_generator():
614603
return RAGenerator(model_name_or_path="facebook/rag-token-nq", generator_type="token", max_length=20)

0 commit comments

Comments
 (0)