Is the consumer-jvm tests supposed to be working? ...
# protobufs
j
Is the consumer-jvm tests supposed to be working? I installed the plugin following the instructions but the test is still failing
r
Yes, check the plugin binary is executable
j
how to check?
i used this 3 commands as per read me (downloading json and then the ziped plugin and then extracting it) looks ok? wget https://github.com/pactflow/pact-protobuf-plugin/releases/download/v-0.1.5/pact-plugin.json -O ~/.pact/plugins/protobuf-0.1.5/pact-plugin.json wget https://github.com/pactflow/pact-protobuf-plugin/releases/download/v-0.1.5/pact-protobuf-plugin-osx-x86_64.gz -O ~/.pact/plugins/protobuf-0.1.5/pact-protobuf-plugin-osx-x86_64.gz gunzip -N ~/.pact/plugins/protobuf-0.1.5/pact-protobuf-plugin-osx-x86_64.gz
r
The gunzip does not make the binary for the plugin executable, leading to https://github.com/pact-foundation/pact-plugins/issues/3
check with
Copy code
❯ ls -la ~/.pact/plugins/protobuf-0.1.5/
total 311140
drwxr-xr-x 5 ronald ronald      4096 May 10 11:43 .
drwxr-xr-x 4 ronald ronald      4096 May 11 14:12 ..
drwxr-xr-x 2 ronald ronald      4096 May 12 10:58 log
-rw-r--r-- 1 ronald ronald       309 Apr 29 10:08 pact-plugin.json
-rwxr-xr-x 1 ronald ronald 316877496 May 10 11:43 pact-protobuf-plugin
drwxr-xr-x 4 ronald ronald      4096 May  5 13:10 protoc
-rw-r--r-- 1 ronald ronald   1699854 May  5 13:10 protoc-3.19.1-linux-x86_64.zip
drwxr-xr-x 2 ronald ronald      4096 May 12 10:58 tmp
It should have
x
set on
pact-protobuf-plugin
j
its all read. how do i install the plugin then? could u advise
r
chmod +x  ~/.pact/plugins/protobuf-0.1.5/pact-protobuf-plugin
will make it executable
j
sorry im very new to PACT im just wondering why this plugin cant be built it part of a library which you can import just like the PACT core module?
just finding the installation and setup of plugin rather troublesome
this looks like the test passed? party parrot
πŸ™Œ 2
r
It's new. It will improve. We can't add direct support for every new protocol because there are so many languages we need to add the support to (there are 10+ Pact supported languages).
j
and for provider how can i run it?
for provider-jvm also just run the test? do i need to explicitly copy the pact?
r
You will need to either copy the pact file, or change the test to point to the file in the consumer build
m
sorry im very new to PACT im just wondering why this plugin cant be built it part of a library which you can import just like the PACT core module?
As Ron said, we need a language independent way to create extension points into the system. For example, you could (if you wanted) write a Pact plugin in whatever language you were comfortable in to support some new feature. Because you don’t need to add it to Pact JS or Pact JVM, you could also choose not to make it a public plugin as well, if that were desired
see also the design objectives here: https://github.com/pact-foundation/pact-plugins
j
Thanks for the background. πŸ‘ so if we need it running in the remote server[for CI/CD purposes] we need one of the steps to install the plugin before running the build?
πŸ‘ 1
r
Yes, in the future we will have a CLI command to install the plugins, but for now you can just use a script
πŸ‘Œ 1
j
Are we able to use this protobuf plugin with pactflow broker?
r
Yes
j
okie let me give it a try. thanks!
hi @rholshausen i was able to publish my consumer for grpc but when i tried publishing my provider it didnt give error but i didnt see the corresponding verification in pactflow. I added
Copy code
import au.com.dius.pact.provider.junitsupport.loader.PactBroker;
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerAuth;

......
......


@PactBroker(host = "<http://airwallex.pactflow.io|airwallex.pactflow.io>", scheme = "https",
        authentication = @PactBrokerAuth( token = "xxxxx"))
in the pact verification for the areacalculator example you all provided and was using this gradle command ./gradlew -DpactPublishResults=true provider:test --tests *Pact*Test Could you please kindly advise
message has been deleted
i was hoping to see a verified contract
m
according to https://docs.pact.io/implementation_guides/jvm/provider/gradle should it be
-P pact.verifier.publishResults=true
?
j
Hey Matt still no joy. I was initially trying to integrate w Junit. Then i tried with gradle it still did not seem to publish I added these lines in the gradle files as per docu. Am i missing something?
Copy code
plugins {
    id "au.com.dius.pact" version '4.1.0'
}
Copy code
pact {

    broker {
        pactBrokerUrl = '<https://airwallex.pactflow.io>'
        pactBrokerToken = 'xxxx-xxxx"'
    }

}
message has been deleted
What i see in the console when i run the test with publish results for provider ^^
r
You need to have the property set on the test environment.
j
sorry do u mind elaborating which property and whether i have an example to refer to what i should add in gradle
r
Ok, when you run tests with Gradle, Gradle starts a new JVM environment to runs the tests. By passing the system property on the command line, you are setting it in the Gradle environment, but not in the test one. You need to tell Gradle to set it on the test environment.
You need to add a test block in your Gradle build file, and set the property there using
systemProperty
j
something like this?
Copy code
test {
    useJUnitPlatform()

    systemProperty 'pact.verifier.publishResults', 'true'
}
r
Yes
j
Finally . This shows it works?
πŸŽ‰ 2
what is the difference between environments and tags?
and is there any docu showing me how i can pass these variables?
r
Pass them in what way?
j
eg during CI/CD during a pr i want to tag it as a dev environment run , and then down the track staging , demo environment
r
Tags are just generic labels. Environments are label specific for an environment
Pact JVM doesn't support environments yet, but you can set the tags or git branch
j
got it
r
pact.provider.tag
or
pact.provider.branch
m
the search in the OSS docs is quite good
j
Thank you. I will give it a read!
is it necessary to put provider version in consumer files or it should be dynamically generated by PACT?
r
The provider version should be specified when verifying the provider