Feisal Ahmad
03/20/2025, 5:06 PMrunTest
method is called which calls pactffi_create_mock_server_for_transport
I see the StartMockServer
method being called on the plugin with the JSON pact only containing the interactions defined up to that point.
Now the part I don’t understand is what the mock server is supposed to do here, is it supposed to listen for all of the defined requests? If so, how are you supposed to distinguish between interactions with the same request but with different provider states? Or is the idea that the mock server only responds to the last defined interaction?rholshausen
03/21/2025, 4:51 AMFeisal Ahmad
03/25/2025, 7:17 PMFeisal Ahmad
03/25/2025, 7:19 PMrholshausen
03/25/2025, 10:19 PMrholshausen
03/25/2025, 10:20 PMrholshausen
03/25/2025, 10:21 PMrholshausen
03/25/2025, 10:23 PMFeisal Ahmad
03/25/2025, 10:50 PMpactffi_with_body
calls
2. Call pactffi_create_mock_server_for_transport
3. Plugin’s StartMockServer rpc receives the interactions set in step 1
4. Pactffi clears the interactions set in step 1 once the mock server stops
My wrapper code does some caching of the interaction data so the pactffi_with_body
calls happen as part of the runTest
method of the wrapper, and I just found it’s not clearing this cacherholshausen
03/25/2025, 10:55 PMFeisal Ahmad
03/25/2025, 11:15 PMrholshausen
03/25/2025, 11:16 PMrholshausen
03/25/2025, 11:16 PMFeisal Ahmad
03/25/2025, 11:16 PMFeisal Ahmad
03/25/2025, 11:18 PMFeisal Ahmad
03/25/2025, 11:18 PMFeisal Ahmad
03/25/2025, 11:19 PMFeisal Ahmad
03/25/2025, 11:19 PMrholshausen
03/25/2025, 11:19 PMFeisal Ahmad
03/25/2025, 11:47 PMrholshausen
03/25/2025, 11:48 PMFeisal Ahmad
03/25/2025, 11:51 PMFeisal Ahmad
03/26/2025, 1:52 AMpactffi_cleanup_plugins(pact_handle);
pactffi_free_pact_handle(pact_handle);
According to the function documentation, the plugin is ref counted so it’s reaching 0 after every test… Should I be holding on to all the pact handles in the test until all the test cases are done?rholshausen
03/26/2025, 3:32 AMrholshausen
03/26/2025, 3:33 AMFeisal Ahmad
03/27/2025, 12:30 PMrholshausen
03/27/2025, 10:12 PMpactffi_free_pact_handle
to not shut down the plugins, but then we loose which handles are using which plugins so you would need to have a way to shut down all plugins at the end of the test run.rholshausen
03/27/2025, 10:14 PM