This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new dbc0afa Fix InstanceId Incompatibility (#4970)
dbc0afa is described below
commit dbc0afa93289d5c5bd41f4fc1661c7ec920350a8
Author: Brendan Doyle <[email protected]>
AuthorDate: Thu Sep 10 05:30:41 2020 -0700
Fix InstanceId Incompatibility (#4970)
Co-authored-by: Brendan Doyle <[email protected]>
---
.../src/main/scala/org/apache/openwhisk/core/entity/InstanceId.scala | 2 ++
.../openwhisk/core/entity/test/ControllerInstanceIdTests.scala | 5 +++++
2 files changed, 7 insertions(+)
diff --git
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceId.scala
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceId.scala
index 5db91c7..e80720f 100644
---
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceId.scala
+++
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceId.scala
@@ -103,6 +103,8 @@ object ControllerInstanceId extends DefaultJsonProtocol {
} else {
deserializationError("could not read ControllerInstanceId")
}
+ case Seq(JsString(asString)) =>
+ new ControllerInstanceId(asString)
case _ =>
deserializationError("could not read ControllerInstanceId")
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ControllerInstanceIdTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ControllerInstanceIdTests.scala
index ba8db58..9c96bb8 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ControllerInstanceIdTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ControllerInstanceIdTests.scala
@@ -46,6 +46,11 @@ class ControllerInstanceIdTests extends FlatSpec with
Matchers {
}
}
+ it should "deserialize legacy ControllerInstanceId format" in {
+ val i = ControllerInstanceId("controller0")
+ ControllerInstanceId.parse(JsObject("asString" ->
JsString("controller0")).compactPrint) shouldBe Success(i)
+ }
+
it should "serialize and deserialize ControllerInstanceId" in {
val i = ControllerInstanceId("controller0")
i.serialize shouldBe JsObject("asString" -> JsString(i.asString),
"instanceType" -> JsString(i.instanceType)).compactPrint