pact-foundation / pact-go

Golang version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
http://pact.io
MIT License
834 stars 104 forks source link

feat: add an Avro example #291

Closed mefellows closed 11 months ago

mefellows commented 1 year ago

Build will fail until https://github.com/austek/pact-avro-plugin/issues/19 is addressed.

YOU54F commented 11 months ago

PR is merged and released now so we should be able to retest this

mefellows commented 11 months ago

Plugin seems to be crashing:

2023-07-11T23:49:10.3233015Z 2023-07-11T23:49:10.250451Z DEBUG   ffi-setup_contents Connection{peer=Client}: h2::codec::framed_read: received frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
2023-07-11T23:49:10.3233983Z 2023-07-11T23:49:10.250558Z ERROR ThreadId(01) pact_plugin_driver::content: Call to plugin failed - status: Unknown, message: "", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc"} }
2023-07-11T23:49:10.3235480Z 2023-07-11T23:49:10.250811Z ERROR ThreadId(01) pact_ffi::plugins: Failed to call out to plugin - Call to plugin failed - status: Unknown, message: "", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc"} }
2023-07-11T23:49:10.3236293Z 2023-07-11T23:49:10.251025Z DEBUG ThreadId(01) pact_mock_server::mock_server: Started mock server on 127.0.0.1:45241
2023-07-11T23:49:10.3237838Z 2023-07-11T23:49:10.253915Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) || Exception in thread "grpc-default-executor-0" java.lang.UnsupportedClassVersionError: au/com/dius/pact/core/model/matchingrules/expressions/MatchingRuleDefinition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
2023-07-11T23:49:10.3239302Z 2023-07-11T23:49:10.253929Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.defineClass1(Native Method)
2023-07-11T23:49:10.3240316Z 2023-07-11T23:49:10.253931Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
2023-07-11T23:49:10.3241393Z 2023-07-11T23:49:10.253933Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
2023-07-11T23:49:10.3242550Z 2023-07-11T23:49:10.253936Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
2023-07-11T23:49:10.3243819Z 2023-07-11T23:49:10.253938Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
2023-07-11T23:49:10.3245084Z 2023-07-11T23:49:10.253940Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
2023-07-11T23:49:10.3246267Z 2023-07-11T23:49:10.253941Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
2023-07-11T23:49:10.3247528Z 2023-07-11T23:49:10.253943Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
2023-07-11T23:49:10.3248565Z 2023-07-11T23:49:10.253945Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
2023-07-11T23:49:10.3249571Z 2023-07-11T23:49:10.253947Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.RuleParser$.parseRules(RuleParser.scala:20)
2023-07-11T23:49:10.3250576Z 2023-07-11T23:49:10.253949Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.RuleParser$.parseRules(RuleParser.scala:15)
2023-07-11T23:49:10.3251604Z 2023-07-11T23:49:10.253950Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroValue$.apply(AvroRecord.scala:77)
2023-07-11T23:49:10.3252650Z 2023-07-11T23:49:10.253952Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.selectField(AvroRecord.scala:433)
2023-07-11T23:49:10.3253704Z 2023-07-11T23:49:10.253954Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.$anonfun$apply$18(AvroRecord.scala:407)
2023-07-11T23:49:10.3254696Z 2023-07-11T23:49:10.253956Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.collection.immutable.List.map(List.scala:246)
2023-07-11T23:49:10.3396693Z 2023-07-11T23:49:10.253958Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.collection.immutable.List.map(List.scala:79)
2023-07-11T23:49:10.3397764Z 2023-07-11T23:49:10.253960Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.apply(AvroRecord.scala:403)
2023-07-11T23:49:10.3398814Z 2023-07-11T23:49:10.253961Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.apply(AvroRecord.scala:399)
2023-07-11T23:49:10.3400247Z 2023-07-11T23:49:10.253963Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionBuilder$.buildResponse(InteractionBuilder.scala:48)
2023-07-11T23:49:10.3401546Z 2023-07-11T23:49:10.253967Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionBuilder$.build(InteractionBuilder.scala:34)
2023-07-11T23:49:10.3402885Z 2023-07-11T23:49:10.253969Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionResponseBuilder$.build(InteractionResponseBuilder.scala:17)
2023-07-11T23:49:10.3404241Z 2023-07-11T23:49:10.253971Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$3(PactAvroPluginService.scala:56)
2023-07-11T23:49:10.3405321Z 2023-07-11T23:49:10.253973Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3406467Z 2023-07-11T23:49:10.253974Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$2(PactAvroPluginService.scala:55)
2023-07-11T23:49:10.3407692Z 2023-07-11T23:49:10.253976Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3408835Z 2023-07-11T23:49:10.253978Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$1(PactAvroPluginService.scala:54)
2023-07-11T23:49:10.3409898Z 2023-07-11T23:49:10.253980Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3411066Z 2023-07-11T23:49:10.253981Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.configureInteraction(PactAvroPluginService.scala:53)
2023-07-11T23:49:10.3412346Z 2023-07-11T23:49:10.253983Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.pact.plugin.pact_plugin.PactPluginGrpc$PactPlugin$.$anonfun$bindService$7(PactPluginGrpc.scala:188)
2023-07-11T23:49:10.3413518Z 2023-07-11T23:49:10.253985Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
2023-07-11T23:49:10.3414700Z 2023-07-11T23:49:10.253987Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
2023-07-11T23:49:10.3415953Z 2023-07-11T23:49:10.253989Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
2023-07-11T23:49:10.3417084Z 2023-07-11T23:49:10.253991Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
2023-07-11T23:49:10.3418123Z 2023-07-11T23:49:10.253992Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
2023-07-11T23:49:10.3419494Z 2023-07-11T23:49:10.253994Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2023-07-11T23:49:10.3420762Z 2023-07-11T23:49:10.253996Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2023-07-11T23:49:10.3421750Z 2023-07-11T23:49:10.253998Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.Thread.run(Thread.java:829)
YOU54F commented 11 months ago

au/com/dius/pact/core/model/matchingrules/expressions/MatchingRuleDefinition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

hmm, do we need a later version of java installed on the runner?

mefellows commented 11 months ago

2023-07-11T23:49:10.3237838Z 2023-07-11T23:49:10.253915Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) || Exception in thread "grpc-default-executor-0" java.lang.UnsupportedClassVersionError: au/com/dius/pact/core/model/matchingrules/expressions/MatchingRuleDefinition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Looks to be the issue here

mefellows commented 11 months ago

I think it's an issue with the plugin, as the plugin itself packages up a JVM or lightweight bootstrapper.

YOU54F commented 11 months ago

oh nice, ty for raising 🙌🏾

coveralls commented 11 months ago

Coverage Status

coverage: 37.338%. remained the same when pulling cc8e0d9b8218247140244bbe3077d97713cda17b on example/avro into b54ab7224493c646b69d99388b72b539502830ce on master.