cloudstateio / kotlin-support

Cloudstate Kotlin Support
https://cloudstate.io/docs/user/lang/kotlin/index.html
Apache License 2.0
8 stars 5 forks source link

Proto compilation fix #12

Closed vkorenev closed 4 years ago

vkorenev commented 4 years ago

Fixes #11 and partially #5. However, mvn clean test is still failing:

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ cloudstate-kotlin-support ---
[INFO] Surefire report directory: /home/vkorenev/Projects/Cloudstate/kotlin-support/cloudstate-kotlin-support/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running io.cloudstate.kotlinsupport.tests.EventSourcedTranscoderTest
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/vkorenev/.m2/repository/org/slf4j/slf4j-simple/1.7.26/slf4j-simple-1.7.26.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/vkorenev/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[main] INFO io.cloudstate.kotlinsupport.transcoding.EventSourcedTranscoder - Executing Transformer...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.08 sec <<< FAILURE!
List Names of Methods in Log(io.cloudstate.kotlinsupport.tests.EventSourcedTranscoderTest)  Time elapsed: 0.018 sec  <<< ERROR!
java.lang.IllegalStateException: The Byte Buddy agent is not initialized
    at net.bytebuddy.agent.ByteBuddyAgent.getInstrumentation(ByteBuddyAgent.java:201)
    at io.cloudstate.kotlinsupport.transcoding.EventSourcedTranscoder.transcode(EventSourcedTranscoder.kt:36)
    at io.cloudstate.kotlinsupport.transcoding.EventSourcedTranscoder.transcode(EventSourcedTranscoder.kt:20)
    at io.cloudstate.kotlinsupport.tests.EventSourcedTranscoderTest.List Names of Methods in Log(EventSourcedTranscoderTest.kt:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running io.cloudstate.kotlinsupport.tests.CrdtTranscoderTest
[main] INFO io.cloudstate.kotlinsupport.transcoding.CrdtTranscoder - Executing Transformer...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec <<< FAILURE!
List Names of Methods in Log(io.cloudstate.kotlinsupport.tests.CrdtTranscoderTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.IllegalStateException: The Byte Buddy agent is not initialized
    at net.bytebuddy.agent.ByteBuddyAgent.getInstrumentation(ByteBuddyAgent.java:201)
    at io.cloudstate.kotlinsupport.transcoding.CrdtTranscoder.transcode(CrdtTranscoder.kt:33)
    at io.cloudstate.kotlinsupport.transcoding.CrdtTranscoder.transcode(CrdtTranscoder.kt:20)
    at io.cloudstate.kotlinsupport.tests.CrdtTranscoderTest.List Names of Methods in Log(CrdtTranscoderTest.kt:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Results :

Tests in error: 
  List Names of Methods in Log(io.cloudstate.kotlinsupport.tests.EventSourcedTranscoderTest): The Byte Buddy agent is not initialized
  List Names of Methods in Log(io.cloudstate.kotlinsupport.tests.CrdtTranscoderTest): The Byte Buddy agent is not initialized

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for kotlin-support 0.4.3:
[INFO] 
[INFO] cloudstate-kotlin-support .......................... FAILURE [ 15.533 s]
[INFO] shopping-cart ...................................... SKIPPED
[INFO] kotlin-pingpong .................................... SKIPPED
[INFO] kotlin-chat ........................................ SKIPPED
[INFO] kotlin-support ..................................... SKIPPED
[INFO] examples ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.952 s
[INFO] Finished at: 2020-04-18T14:16:02-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project cloudstate-kotlin-support: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/vkorenev/Projects/Cloudstate/kotlin-support/cloudstate-kotlin-support/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
sleipnir commented 4 years ago

Hello, this is happening because there was a modification that tried to prevent the call to install the Bytebuddy agent from being made more than once at runtime, with that I removed the call from the transcoder classes and put it in CloudstateInitializer, with that the test was broken without me noticing. I'm sorry for that.

sleipnir commented 4 years ago

Hi @vkorenev I fixed this in https://github.com/cloudstateio/kotlin-support/issues/13

Thanks for the PR. Great job and welcome to the project.