Skip to content

Commit

Permalink
CORE-9031: Add forceUpgrade parameter to VirtualNodeUpgradeRequest (#…
Browse files Browse the repository at this point in the history
…1263)

This adds an optional forceUpgrade field to the VirtualNodeUpgradeRequest schema which defaults to false.
  • Loading branch information
Tom-Fitzpatrick authored Oct 4, 2023
1 parent e5d1c58 commit 4f8bdaf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"name": "actor",
"type": "string",
"doc": "ID of RPC user that requested the virtual node creation."
},
{
"name": "forceUpgrade",
"type": "boolean",
"doc": "Whether this upgrade should be forced regardless of OperationInProgress.",
"default": false
}
]
}
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}"
)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0
# NOTE: update this each time this module contains a breaking change
## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to
## a per module property in which case module versions can change independently.
cordaApiRevision = 27
cordaApiRevision = 28

# Main
kotlinVersion = 1.8.21
Expand Down

0 comments on commit 4f8bdaf

Please sign in to comment.