Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log line receiver #48

Merged
merged 8 commits into from
Sep 15, 2016
Merged

Log line receiver #48

merged 8 commits into from
Sep 15, 2016

Conversation

bjgbeelen
Copy link
Contributor

This PR provides a way to access the container logs, which might be useful for debugging purposes.
Fix for #34

@amcnerlin
Copy link

+1 for this - very useful feature - thanks

@viktortnk
Copy link
Contributor

Thanks for PR

When I try to run test, I got following

[info] DeferredAbortedSuite:
[info] Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite *** ABORTED ***
[info]   java.lang.NoSuchMethodError: com.whisk.docker.DockerContainer.<init>(Ljava/lang/String;Lscala/Option;Lscala/collection/immutable/Map;ZZLscala/collection/immutable/Map;Lscala/collection/Seq;Lcom/whisk/docker/DockerReadyChecker;Lscala/collection/Seq;)V
[info]   at com.whisk.docker.DockerMongodbService$class.$init$(DockerMongodbService.scala:7)
[info]   at com.whisk.docker.MongodbServiceSpec.<init>(MongodbServiceSpec.scala:9)
[info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Also I don't think signature String => Unit is enough here. I'd like to see a mechanism which correctly closes LogReceiver with both implementations: docker-java and Spotify's docker client

@bjgbeelen
Copy link
Contributor Author

Hi viktor. I tried running the tests but couldn't reproduce the error you got.
I do however (still) get an error on the AllAtOnceSpec:

[info] Exception encountered when attempting to run a suite with class name: com.whisk.docker.AllAtOnceSpec *** ABORTED ***
[info]   java.lang.RuntimeException: Cannot run all required containers
[info]   at com.whisk.docker.DockerKit$class.startAllOrFail(DockerKit.scala:61)
[info]   at com.whisk.docker.AllAtOnceSpec.startAllOrFail(AllAtOnceSpec.scala:6)
[info]   at com.whisk.docker.scalatest.DockerTestKit$class.beforeAll(DockerTestKit.scala:21)
[info]   at com.whisk.docker.AllAtOnceSpec.beforeAll(AllAtOnceSpec.scala:6)
[info]   at org.scalatest.BeforeAndAfterAll$class.beforeAll(BeforeAndAfterAll.scala:187)
[info]   at com.whisk.docker.AllAtOnceSpec.beforeAll(AllAtOnceSpec.scala:6)
[info]   at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:253)
[info]   at com.whisk.docker.AllAtOnceSpec.run(AllAtOnceSpec.scala:6)
[info]   at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:357)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:502)

Regarding your error, it's complaining about a NoSuchMethodError. Maybe a sbt clean helps?

I'll think about your request to introduce a mechanism to correctly close the LogReceiver

@viktortnk
Copy link
Contributor

Nope, sbt clean doesn't help

I'm running

./sbt "scalatest/test-only com.whisk.docker.MongodbServiceSpec"

@bjgbeelen
Copy link
Contributor Author

Weird

docker-it-scala git:(log-line-receiver) ✗ ./sbt "scalatest/test-only com.whisk.docker.MongodbServiceSpec"
[info] Loading global plugins from /Users/bjgbeelen/.sbt/0.13/plugins
[info] Updating {file:/Users/bjgbeelen/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /Users/bjgbeelen/Projects/Forks/docker-it-scala/project
[info] Updating {file:/Users/bjgbeelen/Projects/Forks/docker-it-scala/project/}docker-it-scala-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to root (in build file:/Users/bjgbeelen/Projects/Forks/docker-it-scala/)
[info] MongodbServiceSpec:
13:22:24.188 [pool-3-thread-2] INFO  c.s.d.client.DefaultDockerClient - Creating container with ContainerConfig: ContainerConfig{hostname=null, domainname=null, username=null, attachStdin=false, attachStdout=null, attachStderr=null, portSpecs=null, exposedPorts=[27017], tty=false, openStdin=null, stdinOnce=null, env=null, cmd=[mongod, --nojournal, --smallfiles, --syncdelay, 0], image=mongo:3.0.6, volumes=null, workingDir=null, entrypoint=null, networkDisabled=null, onBuild=null, labels=null, macAddress=null, hostConfig=HostConfig{binds=null, containerIDFile=null, lxcConf=null, privileged=null, portBindings={27017=[PortBinding{hostIp=0.0.0.0, hostPort=}]}, links=null, publishAllPorts=null, dns=null, dnsSearch=null, extraHosts=null, volumesFrom=null, capAdd=null, capDrop=null, networkMode=null, securityOpt=null, devices=null, memory=null, memorySwap=null, cpuShares=null, cpusetCpus=null, cpuQuota=null, cgroupParent=null, restartPolicy=null, logConfig=null, ipcMode=null}, stopSignal=null}
13:22:24.270 [pool-3-thread-1] INFO  c.s.d.client.DefaultDockerClient - Starting container with Id: 5ab97ae54e7bbc2db63890128fb4c60f6c1f18ab0d949450b8d507d440522507
[info] mongodb node
[info] - should be ready with log line checker
[info] Run completed in 3 seconds, 314 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 4 s, completed Sep 12, 2016 1:22:25 PM

@viktortnk
Copy link
Contributor

hm, worked on fresh repository.

Please also consider second part of comment about closing event logger.

So maybe container spec should accept impl of trait with methods onNext(logLine: String) and close(): Unit

@viktortnk
Copy link
Contributor

Merging now as it is. We might implement suggested feature later. Thanks

@viktortnk viktortnk merged commit 0690ba3 into whisklabs:master Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants