-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit test for change to VirtualNodeUpgradeRequest avro schema
Signed-off-by: TomFitzpatrick <[email protected]>
- Loading branch information
1 parent
2ce6048
commit 444c0dc
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...est/kotlin/net/corda/data/virtualnode/VirtualNodeUpgradeRequestSchemaCompatibilityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.corda.data.virtualnode | ||
|
||
import org.apache.avro.Schema | ||
import org.apache.avro.SchemaCompatibility | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
|
||
class VirtualNodeUpgradeRequestSchemaCompatibilityTest { | ||
|
||
@Test | ||
fun `VirtualNodeUPgradeRequest schema changes between Corda 5_0 and 5_1 are compatible`() { | ||
val schemaV50Json = """ | ||
{ | ||
"type": "record", | ||
"name": "VirtualNodeUpgradeRequest", | ||
"namespace": "net.corda.data.virtualnode", | ||
"fields": [ | ||
{ | ||
"name": "virtualNodeShortHash", | ||
"type": "string", | ||
"doc": "Short hash of the virtual node / holding identity." | ||
}, | ||
{ | ||
"name": "cpiFileChecksum", | ||
"type": "string", | ||
"doc": "The checksum of the CPI file." | ||
}, | ||
{ | ||
"name": "actor", | ||
"type": "string", | ||
"doc": "ID of RPC user that requested the virtual node creation." | ||
} | ||
] | ||
} | ||
""".trimIndent() | ||
|
||
val schemaV50 = Schema.Parser().parse(schemaV50Json) | ||
val schemaV51 = VirtualNodeUpgradeRequest.`SCHEMA$` | ||
|
||
val compatibility = SchemaCompatibility.checkReaderWriterCompatibility(schemaV51, schemaV50) | ||
Assertions.assertEquals( | ||
compatibility.type, | ||
SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, | ||
"Failed due to incompatible change. ${compatibility.description}" | ||
) | ||
} | ||
} |