Changeset ef964d8 in flexoentity for tests/test_id_stress.py
- Timestamp:
- 11/27/25 18:12:23 (7 weeks ago)
- Branches:
- master
- Children:
- 4e11d58
- Parents:
- 9a50e0b
- File:
-
- 1 edited
-
tests/test_id_stress.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/test_id_stress.py
r9a50e0b ref964d8 9 9 10 10 import pytest 11 12 from flexoentity import FlexOID, EntityType, EntityState 11 from uuid import uuid4 12 from flexoentity import FlexOID, EntityType, EntityState, FlexoSignature 13 13 14 14 logger = logging.getLogger(__name__) … … 66 66 assert id1 == id2 67 67 68 def test_massive_lifecycle_simulation(cert_ref_linux, sample_domain): 69 """ 70 Generate 100 random FlexoSignatures, mutate content, run through lifecycle, 71 and ensure all FlexOIDs are unique and valid. 72 """ 73 entities = [] 68 74 69 def test_massive_lifecycle_simulation(sample_question): 70 """ 71 Generate 100 random SingleChoiceQuestions, simulate multiple edits and state transitions, 72 ensure all final IDs and fingerprints are unique and valid. 73 """ 74 entities = [ 75 copy.deepcopy(sample_question) for _ in range(100) 76 ] 75 for i in range(100): 76 sig = FlexoSignature.with_domain_id( 77 domain_id="SIGTEST", 78 signed_entity=sample_domain.flexo_id, 79 signer_id=uuid4(), 80 certificate_reference=cert_ref_linux, 81 comment=f"Initial signature #{i}" 82 ) 83 entities.append(sig) 77 84 85 # Mutate + lifecycle transitions 78 86 for i, e in enumerate(entities): 79 # random edit80 e. text += f" updated #{i}"87 # CONTENT CHANGE → fingerprint changes → hash → FlexOID.prefix changes 88 e.comment += f" updated-{i}" 81 89 e._update_fingerprint() 82 90 … … 88 96 e.publish() 89 97 90 flexoids = [e.flexo_id for e in entities] 91 assert len(flexoids) == len(set(flexoids)), "Duplicate FlexOIDs after lifecycle simulation" 98 # Check ID uniqueness 99 flexoids = [str(e.flexo_id) for e in entities] 100 assert len(flexoids) == len(set(flexoids)), "Duplicate FlexOIDs detected"
Note:
See TracChangeset
for help on using the changeset viewer.
