diff --git a/integrationtests/test_issues.py b/integrationtests/test_issues.py index 441edac5481585e483c94d61d864a1baaa139aa2..2ec772a2f7f3166325cfe4f6ab0ea7d8b9d82a69 100644 --- a/integrationtests/test_issues.py +++ b/integrationtests/test_issues.py @@ -18,22 +18,24 @@ # from pytest import fixture, mark -import caosdb as db -from caosdb.cached import cache_clear +import linkahead as db +from linkahead.cached import cache_clear from caosadvancedtools.models.parser import parse_model_from_string from caoscrawler.crawl import Crawler +from caoscrawler.identifiable import Identifiable from caoscrawler.identifiable_adapters import CaosDBIdentifiableAdapter from caoscrawler.structure_elements import DictElement from caoscrawler.scanner import create_converter_registry, scan_structure_elements -from caosdb.utils.register_tests import clear_database, set_test_key +from linkahead.utils.register_tests import clear_database, set_test_key set_test_key("10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2") @fixture(autouse=True) def clear_cache(): + """Clear the LinkAhead cache.""" cache_clear() @@ -266,3 +268,29 @@ Campaign: # Nothing to do for the existing ents assert len(ups) == 0 assert ins[0].name == event.name + + +def test_indiscale_87(clear_database): + """Handle long string queries gracefully. + + https://gitlab.com/linkahead/linkahead-crawler/-/issues/87 + """ + + prop = db.Property(name="str", datatype=db.TEXT).insert() + rt = db.RecordType(name="RT1").add_property(prop).insert() + strings = [ + "0123456789" * 26, + "0" * 260, + "0123456789" * 25 + "9876543210", + ] + recs = [ + db.Record().add_parent(rt).add_property(name="str", value=string).insert() + for string in strings + ] + idents = [ + Identifiable(record_type="RT1", properties={"str": string}) + for string in strings + ] + adapter = CaosDBIdentifiableAdapter() + for rec, ident in zip(recs, idents): + assert adapter.retrieve_identified_record_for_identifiable(ident) == rec