@@ -25,6 +25,7 @@ import akka.util.ByteString
2525import common .{StreamLogging , WskActorSystem }
2626import org .scalatest .Matchers
2727import spray .json ._
28+ import spray .json .DefaultJsonProtocol ._
2829import whisk .common .TransactionId
2930import whisk .core .containerpool .logging .{DockerToActivationFileLogStore , LogLine }
3031import whisk .core .entity ._
@@ -41,14 +42,21 @@ class DockerToActivationFileLogStoreTests
4142
4243 override def createStore () = new TestLogStoreTo (Sink .ignore)
4344
44- def toLoggedEvent (line : LogLine , userId : UUID , activationId : ActivationId , actionName : FullyQualifiedEntityName ) = {
45+ def toLoggedEvent (line : LogLine ,
46+ userId : UUID ,
47+ activationId : ActivationId ,
48+ actionName : FullyQualifiedEntityName ): String = {
4549 val event = line.toJson.compactPrint
4650 val concatenated =
47- s """ ,"activationId":" ${activationId.asString}","action":" ${actionName.asString}","userId ":" ${userId.asString}" """
51+ s """ ,"activationId":" ${activationId.asString}","action":" ${actionName.asString}","namespaceId ":" ${userId.asString}" """
4852
4953 event.dropRight(1 ) ++ concatenated ++ " }\n "
5054 }
5155
56+ def toLoggedActivation (activation : WhiskActivation ): String = {
57+ JsObject (activation.toJson.fields ++ Map (" namespaceId" -> user.authkey.uuid.asString.toJson)).compactPrint + " \n "
58+ }
59+
5260 behavior of " DockerCouchDbFileLogStore"
5361
5462 it should " read logs returned by the container,in mem and enrich + write them to the provided sink" in {
@@ -70,7 +78,7 @@ class DockerToActivationFileLogStoreTests
7078 }
7179
7280 // Last message should be the full activation
73- testActor.expectMsg(activation.toJson.compactPrint + " \n " )
81+ testActor.expectMsg(toLoggedActivation( activation) )
7482 }
7583
7684 class TestLogStoreTo (override val writeToFile : Sink [ByteString , _])
0 commit comments