This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
forked from onyx-dot-app/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test overlapping connectors (but using a source that is way too big a… (
onyx-dot-app#3152) * test overlapping connectors (but using a source that is way too big and slow, fix that next) * pass thru secrets * rename * rename again * now we are fixing it --------- Co-authored-by: Richard Kuo <[email protected]>
- Loading branch information
1 parent
0ff2565
commit 8309f4a
Showing
3 changed files
with
91 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
backend/tests/integration/tests/connector/test_connector_creation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import os | ||
from datetime import datetime | ||
from datetime import timezone | ||
|
||
from danswer.server.documents.models import DocumentSource | ||
from tests.integration.common_utils.managers.cc_pair import CCPairManager | ||
from tests.integration.common_utils.managers.user import UserManager | ||
from tests.integration.common_utils.test_models import DATestUser | ||
|
||
|
||
def test_connector_creation(reset: None) -> None: | ||
# Creating an admin user (first user created is automatically an admin) | ||
admin_user: DATestUser = UserManager.create(name="admin_user") | ||
|
||
# create connectors | ||
cc_pair_1 = CCPairManager.create_from_scratch( | ||
source=DocumentSource.INGESTION_API, | ||
user_performing_action=admin_user, | ||
) | ||
|
||
cc_pair_info = CCPairManager.get_single( | ||
cc_pair_1.id, user_performing_action=admin_user | ||
) | ||
assert cc_pair_info | ||
assert cc_pair_info.creator | ||
assert str(cc_pair_info.creator) == admin_user.id | ||
assert cc_pair_info.creator_email == admin_user.email | ||
|
||
|
||
def test_overlapping_connector_creation(reset: None) -> None: | ||
"""Tests that connectors indexing the same documents don't interfere with each other. | ||
A previous bug involved document by cc pair entries not being added for new connectors | ||
when the docs existed already via another connector and were up to date relative to the source. | ||
""" | ||
admin_user: DATestUser = UserManager.create(name="admin_user") | ||
|
||
config = { | ||
"wiki_base": os.environ["CONFLUENCE_TEST_SPACE_URL"], | ||
"space": "DailyConne", | ||
"is_cloud": True, | ||
"page_id": "", | ||
} | ||
|
||
credential = { | ||
"confluence_username": os.environ["CONFLUENCE_USER_NAME"], | ||
"confluence_access_token": os.environ["CONFLUENCE_ACCESS_TOKEN"], | ||
} | ||
|
||
# store the time before we create the connector so that we know after | ||
# when the indexing should have started | ||
now = datetime.now(timezone.utc) | ||
|
||
# create connector | ||
cc_pair_1 = CCPairManager.create_from_scratch( | ||
source=DocumentSource.CONFLUENCE, | ||
connector_specific_config=config, | ||
credential_json=credential, | ||
user_performing_action=admin_user, | ||
) | ||
|
||
CCPairManager.wait_for_indexing( | ||
cc_pair_1, now, timeout=120, user_performing_action=admin_user | ||
) | ||
|
||
now = datetime.now(timezone.utc) | ||
|
||
cc_pair_2 = CCPairManager.create_from_scratch( | ||
source=DocumentSource.CONFLUENCE, | ||
connector_specific_config=config, | ||
credential_json=credential, | ||
user_performing_action=admin_user, | ||
) | ||
|
||
CCPairManager.wait_for_indexing( | ||
cc_pair_2, now, timeout=120, user_performing_action=admin_user | ||
) | ||
|
||
info_1 = CCPairManager.get_single(cc_pair_1.id, user_performing_action=admin_user) | ||
assert info_1 | ||
|
||
info_2 = CCPairManager.get_single(cc_pair_2.id, user_performing_action=admin_user) | ||
assert info_2 | ||
|
||
assert info_1.num_docs_indexed == info_2.num_docs_indexed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters