sven-lange-last commented on a change in pull request #2878: Streamingly read 
user-logs.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2878#discussion_r152233128
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerTests.scala
 ##########
 @@ -429,34 +446,35 @@ class DockerContainerTests
     bb
   }
 
-  def toRawLog(log: Seq[LogLine], appendSentinel: Boolean = true): ByteBuffer 
= {
+  def toRawLog(log: Seq[LogLine], appendSentinel: Boolean = true): ByteString 
= {
     val appendedLog = if (appendSentinel) {
       val lastTime = log.lastOption.map { case LogLine(time, _, _) => time 
}.getOrElse(Instant.EPOCH.toString)
       log :+
-        LogLine(lastTime, "stderr", 
s"${DockerActionLogDriver.LOG_ACTIVATION_SENTINEL}\n") :+
-        LogLine(lastTime, "stdout", 
s"${DockerActionLogDriver.LOG_ACTIVATION_SENTINEL}\n")
+        LogLine(lastTime, "stderr", 
s"${DockerContainer.ActivationSentinel.utf8String}\n") :+
+        LogLine(lastTime, "stdout", 
s"${DockerContainer.ActivationSentinel.utf8String}\n")
     } else {
       log
     }
-    toByteBuffer(appendedLog.map(_.toJson.compactPrint).mkString("", "\n", 
"\n"))
+    ByteString(appendedLog.map(_.toJson.compactPrint).mkString("", "\n", "\n"))
   }
 
   it should "read a simple log with sentinel" in {
     val expectedLogEntry = LogLine(Instant.EPOCH.toString, "stdout", "This is 
a log entry.\n")
     val rawLog = toRawLog(Seq(expectedLogEntry), appendSentinel = true)
-    val readResults = mutable.Queue(rawLog)
 
     implicit val docker = new TestDockerClient {
-      override def rawContainerLogs(containerId: ContainerId, fromPos: Long): 
Future[ByteBuffer] = {
+      override def rawContainerLogs(containerId: ContainerId,
+                                    fromPos: Long,
+                                    pollInterval: Option[FiniteDuration]): 
Source[ByteString, Any] = {
         rawContainerLogsInvocations += ((containerId, fromPos))
 
 Review comment:
   We should also record and check the `pollInterval` that is passed. This test 
is about reading the log with sentinel. So we expect `rawContainerLogs()` to 
re-read the file until the sentinel can be found or a timeout passes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to