Skip to content

Commit

Permalink
Add more tests for detecting changes to VectorMembers
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 2, 2024
1 parent 6233cdd commit 2282a95
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/podio_schema_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ def heuristics(self):
f"Forbidden schema change in '{vmc.klassname}': Added vector member '{vmc.member}'"
)

dropped_vecmems = [c for c in schema_changes if isinstance(c, DroppedVectorMember)]
for vmc in dropped_vecmems:
self.errors.append(
f"Forbidden schema change in '{vmc.klassname}': Added vector member '{vmc.member_name}'"
)

# are the member changes actually supported/supportable?
changed_members = [
change for change in schema_changes if isinstance(change, ChangedMember)
Expand Down
1 change: 1 addition & 0 deletions tests/schema_evolution/detection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(should_fail_cases
vector_members:add_new
vector_members:add_additional
)

set(should_succeed_cases
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
schema_version: 2

datatypes:
DataTypeWithOneVectorMember:
Description: "Type for testing the addition of new VectorMembers"
Author: "Thomas Madlener"
VectorMembers:
- float f // a float
- int i // an additional float
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
schema_version: 1

datatypes:
DataTypeWithOneVectorMember:
Description: "Type for testing the addition of new VectorMembers"
Author: "Thomas Madlener"
VectorMembers:
- float f // a float
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
schema_version: 2

datatypes:
DataTypeWithSomeVectorMember:
Description: "Type for testing the removal of one VectorMember"
Author: "Thomas Madlener"
VectorMembers:
- double d // some doubles never hurt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
schema_version: 1

datatypes:
DataTypeWithSomeVectorMember:
Description: "Type for testing the removal of one VectorMember"
Author: "Thomas Madlener"
VectorMembers:
- float f // a float
- double d // some doubles never hurt

0 comments on commit 2282a95

Please sign in to comment.