Skip to content

Commit d54e017

Browse files
xunyin8claude
andcommitted
[controller] Stub normalizeSchemaForMigration in parent admin test mock
VeniceParentHelixAdmin#createStore and #addValueSchema now route value schemas through VeniceHelixAdmin#normalizeSchemaForMigration. The internal admin is a Mockito mock in TestVeniceParentHelixAdmin, so the unstubbed method returned null and blanked out the value schema, producing NPEs during admin-message serialization and strict schema parsing. Mirror production's non-migration passthrough behavior by stubbing the method to return its schema argument verbatim. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4008fa6 commit d54e017

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

services/venice-controller/src/test/java/com/linkedin/venice/controller/AbstractTestVeniceParentHelixAdmin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public void setupInternalMocks() {
9898
doReturn(topicManager).when(internalAdmin).getTopicManager();
9999
SchemaEntry mockEntry = new SchemaEntry(0, TEST_SCHEMA);
100100
doReturn(mockEntry).when(internalAdmin).getKeySchema(anyString(), anyString());
101+
// Outside a store-migration context, schema normalization is a passthrough. Mirror that here so
102+
// the mocked internal admin doesn't return null and blank out the value schema during createStore/
103+
// addValueSchema.
104+
when(internalAdmin.normalizeSchemaForMigration(anyString(), anyString(), any()))
105+
.thenAnswer(invocation -> invocation.getArgument(2));
101106

102107
zkClient = mock(ZkClient.class);
103108
doReturn(zkClient).when(internalAdmin).getZkClient();

0 commit comments

Comments
 (0)