Yousaf Nabi (pactflow.io)
Eytan Hanig
09/01/2023, 3:07 AMChristophe Laranjo
09/01/2023, 7:10 PMSathish Sundararajan
09/05/2023, 5:12 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Jason Taylor
09/06/2023, 3:52 PMFrancisco Barril
09/06/2023, 9:53 PMpackage events
import (
"<http://github.com/pact-foundation/pact-go/dsl|github.com/pact-foundation/pact-go/dsl>"
"systems-management/database"
"testing"
)
var cenas = func(m dsl.Message) error {
return processTrackerUpdateEvent(*m.Content.(*TrackerUpdateEvent))
}
func TestMessageConsumer_Success(t *testing.T) {
pact := dsl.Pact{
Consumer: "MyConsumer",
Provider: "MyProvider",
}
message := pact.AddMessage()
message.Given("couves").
ExpectsToReceive("assadas").
WithContent(
//TrackerUpdateEvent{
// Tracker: database.Tracker{},
// TrackerUpdateRequest: database.TrackerUpdateRequest{},
//},
map[string]interface{}{
"Tracker": database.Tracker{},
"TrackerUpdateRequest": database.TrackerUpdateRequest{},
},
).
AsType(TrackerUpdateEvent{})
pact.VerifyMessageConsumer(t, message, cenas)
}
and I am getting the error
panic: interface conversion: interface {} is map[string]interface {}, not *events.TrackerUpdateEvent [recovered]
panic: interface conversion: interface {} is map[string]interface {}, not *events.TrackerUpdateEvent
any help ? thank you 🙏Sathish Sundararajan
09/08/2023, 2:43 PMTigran Davtyan
09/12/2023, 3:14 AMSrinivas Nali
09/12/2023, 10:37 AMAllen Ayala
09/14/2023, 6:13 PMGeorg Duemlein
09/18/2023, 4:10 AMHazem Borham
09/28/2023, 6:50 PMKaterina Foniok
10/02/2023, 12:47 PMpending pact
feature for synchronization. The good thing is it doesn't fail the suite, but it seems the tests are run twice - is that expected? It also seems that the verifyRequest.AfterEach
is ignored somehow as the second run reports that resources already exist. Maybe I have something bad in my configuration, could you help me find a culprit please? Adding screens and log to the thread.Corey Maynard
10/03/2023, 8:24 PMAnanya Mohanty
10/11/2023, 10:58 AMgo test -mod=readonly -v .
Getting this error when I include the "<http://github.com/pact-foundation/pact-go/v2/consumer|github.com/pact-foundation/pact-go/v2/consumer>"
package
Is anyone familiar with this?
# <http://github.com/pact-foundation/pact-go/v2/internal/native|github.com/pact-foundation/pact-go/v2/internal/native>
Undefined symbols for architecture x86_64:
"_pactffi_create_mock_server_for_transport", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_create_mock_server_for_transport in _x003.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_create_mock_server_for_transport)
"_pactffi_verifier_add_custom_header", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_add_custom_header in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_add_custom_header)
"_pactffi_verifier_add_provider_transport", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_add_provider_transport in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_add_provider_transport)
"_pactffi_verifier_new_for_application", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_new_for_application in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_new_for_application)
"_pactffi_verifier_set_filter_info", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_filter_info in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_filter_info)
"_pactffi_verifier_set_no_pacts_is_error", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_no_pacts_is_error in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_no_pacts_is_error)
"_pactffi_verifier_set_publish_options", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_publish_options in _x005.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_verifier_set_publish_options)
"_pactffi_with_header_v2", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_with_header_v2 in _x004.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_with_header_v2)
"_pactffi_with_query_parameter_v2", referenced from:
__cgo_df62a8d4863b_Cfunc_pactffi_with_query_parameter_v2 in _x004.o
(maybe you meant: __cgo_df62a8d4863b_Cfunc_pactffi_with_query_parameter_v2)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FAIL //[build failed]
FAIL
Matt (pactflow.io / pact-js / pact-go)
Katerina Foniok
10/19/2023, 1:34 PMpending
more then passing. Thx!
Log from my test:
023/10/19 13:00:03 [INFO] executing state handler middleware
2023/10/19 13:00:03 [WARN] no state handler found for state: ComponentDetectionQuery progressing
2023-10-19T11:00:03.919419Z INFO ThreadId(13) pact_verifier: Running provider verification for 'request to return CDQ'
2023-10-19T11:00:03.919461Z INFO ThreadId(13) pact_verifier::provider_client: Sending request to provider at <http://localhost:43615/>
2023-10-19T11:00:03.919465Z INFO ThreadId(13) pact_verifier::provider_client: Sending request HTTP Request ( ... )
2023-10-19T11:00:03.921893Z INFO ThreadId(13) pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(430 bytes) )
2023-10-19T11:00:03.922307Z INFO ThreadId(13) pact_verifier: Running teardown provider state change handler 'ComponentDetectionQuery progressing' for 'request to return CDQ'
2023/10/19 13:00:03 [INFO] executing state handler middleware
2023/10/19 13:00:03 [WARN] no state handler found for state: ComponentDetectionQuery progressing
...
request to return CDQ (0s loading, 5ms verification)
Given ComponentDetectionQuery progressing
returns a response which
has status code 200 (OK)
includes headers
"Content-Type" with value "application/json" (OK)
has a matching body (OK)
Cody A. Ray
10/23/2023, 9:07 PMKaterina Foniok
10/24/2023, 10:04 AMinteraction('Getting application', ({ provider, execute }) => {
beforeEach(() => {
provider
.given("Application exists", appParams)
.given("Application has components", compParams)
.uponReceiving('Get app with its components.')
.withRequest(contract.request)
.willRespondWith(contract.response);
});
...
}
The log is like this:
2023-10-24T08:30:08.922544Z INFO ThreadId(13) pact_verifier: Running setup provider state change handler 'Application exists' for 'Get app with its components.'
beforeeach - clean up
2023/10/24 10:30:08 [INFO] executing state handler middleware
application created
2023-10-24T08:30:09.190301Z INFO ThreadId(13) pact_verifier: Running setup provider state change handler 'Application has components' for 'Get app with its components.'
beforeeach - clean up
application removed
2023/10/24 10:30:09 [INFO] executing state handler middleware
"create component error": "unable to get the Application"
In the doc I found that multiple state setup is upported in V3 scheme, which is what we're using. Am I doing anything wrong?Srinivas Nali
10/24/2023, 4:12 PM=== RUN Test_HandlerContract
2023/10/24 16:10:39 [INFO] checking pact-provider-verifier within range >= 1.36.1, < 2.0.0
2023/10/24 16:10:39 [ERROR] CLI tools are out of date, please upgrade before continuing
while running go test
even though I installed the pact-cli, updated the path and got pact-go depsSrinivas Nali
10/24/2023, 4:13 PMBruno Holanda
10/27/2023, 6:47 PMRuth
10/30/2023, 8:56 PMSrinivas Nali
10/31/2023, 11:18 AMSrinivas Nali
10/31/2023, 5:05 PM"items": dsl.EachLike(map[string]interface{}{
"id": "1270284",
"qty": dsl.Integer(),
}, 1),
and on Provider test, used the data for verification like
"data": {
"date": "2023-11-06",
"reference": "123",
"items": [
{
},
{
}
]
}
still test is passing. Shouldn't it fail the match? for itemsCody Jenkins
11/01/2023, 2:39 AMLukasz
11/29/2023, 6:54 AMChristophe Laranjo
12/01/2023, 10:57 PM