Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix schema evolution when switching component members #627

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/podio_schema_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AddedComponent(SchemaChange):
def __init__(self, component, name):
self.component = component
self.name = name
super().__init__(f"'{self.component.name}' has been added")
super().__init__(f"'{self.name}' has been added")


class DroppedComponent(SchemaChange):
Expand Down
16 changes: 16 additions & 0 deletions tests/schema_evolution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,20 @@ function(PODIO_CREATE_READ_NEW_DATA_TEST sourcefile additional_libs)
)
endfunction()

add_test(
NAME schema-evolution-script
COMMAND ${PROJECT_SOURCE_DIR}/python/podio_schema_evolution.py
${CMAKE_CURRENT_SOURCE_DIR}/datalayout_new.yaml
${PROJECT_SOURCE_DIR}/tests/datalayout.yaml
)

add_test(
NAME schema-evolution-script-with-evol
COMMAND
${PROJECT_SOURCE_DIR}/python/podio_schema_evolution.py
--evo ${CMAKE_CURRENT_SOURCE_DIR}/schema_evolution.yaml
${CMAKE_CURRENT_SOURCE_DIR}/datalayout_new.yaml
${PROJECT_SOURCE_DIR}/tests/datalayout.yaml
)

add_subdirectory(root_io)
7 changes: 6 additions & 1 deletion tests/schema_evolution/datalayout_new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ components :
- int x
- int y_new

ex2::NamespaceStructLong:
Members:
- int64_t x
- int64_t y_new

ex2::NamespaceInNamespaceStruct:
Members:
- ex2::NamespaceStruct data
Expand Down Expand Up @@ -191,7 +196,7 @@ datatypes :
Members:
- std::int16_t i16Val{42} // some int16 value
- std::array<float, 2> floats {3.14f, 1.23f} // some float values
- ex2::NamespaceStruct s{10, 11} // one that we happen to know works
- ex2::NamespaceStructLong s{10, 11} // one that we happen to know works
- double d{9.876e5} // double val
- CompWithInit comp // To make sure that the default initializer of the component does what it should

Expand Down