Viacheslav Blinov created IGNITE-25264:
------------------------------------------
Summary: Catalog serialization tests improvements
Key: IGNITE-25264
URL: https://issues.apache.org/jira/browse/IGNITE-25264
Project: Ignite
Issue Type: Improvement
Affects Versions: 3.0
Reporter: Viacheslav Blinov
Assignee: Maksim Zhuravkov
Currently we have a few problems in catalog serialization tests:
* tests code is a mixture of data fixtures, algorithms of making a check and
assertions - it would be beneficial for supportability of the tests to split
those aspects
* tests make incorrect assumption that the version of entity serialization
format should be the same as the version of the overall serialization protocol,
while the design of the feature intended to make those aspects separate, in
particular:
{code:java}
private static class VersionCheckingProvider implements
CatalogEntrySerializerProvider {
private final CatalogEntrySerializerProvider provider;
private final int protocolVersion;
private VersionCheckingProvider(int expectedProtocolVersion) {
this.provider = DEFAULT_PROVIDER;
this.protocolVersion = expectedProtocolVersion;
}
@Override
public <T extends MarshallableEntry> CatalogObjectSerializer<T> get(int
version, int typeId) {
CatalogObjectSerializer<MarshallableEntry> serializer =
provider.get(version, typeId);
checkVersion(typeId, version);
return (CatalogObjectSerializer<T>) serializer;
}
@Override
public int latestSerializerVersion(int typeId) {
int latest = provider.latestSerializerVersion(typeId);
checkVersion(typeId, latest);
return latest;
}
private void checkVersion(int typeId, int entryVersion) {
if (entryVersion != protocolVersion) {
Assertions.fail("Requested unexpected version for type " + typeId +
". Expected version must be " + protocolVersion);
}
}
} {code}
* tests lack utility infrastructure to easily create new binary fixtures to
add new testcases with changed serialization format for specific entities, some
simple utility to create a new binary asset to be used in a deserialization
test later would be beneficial
--
This message was sent by Atlassian Jira
(v8.20.10#820010)