Diana Nguyen
10/11/2023, 2:42 PMSuat Köse (Hepsiburada/Bilgi Teknolojileri)
10/12/2023, 12:14 PMcanIDeploy:
stage: canIDeploy
before_script:
- apk add bash
- apk add curl
needs:
- test
script:
- curl -fsSL <https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh> | PACT_CLI_VERSION=v2.0.7 bash
- ./pact/bin/pact-broker can-i-deploy --pacticipant Foo --latest
tags:
- k8s
Pratibha Kachi
10/12/2023, 9:14 PMWei Huang
10/17/2023, 9:56 PMAllen Ayala
10/19/2023, 3:13 PMNathan Farmer
10/21/2023, 1:30 AMLike
, how can I "clean" these dictionaries or otherwise use them for unit tests?Mattias Björklund
10/21/2023, 9:09 PMMarek Urbanowicz
10/24/2023, 10:02 AMBartosz Kwapisz
10/24/2023, 10:49 AMTanyagorn B.
10/25/2023, 8:25 AMRoger Liu
10/27/2023, 7:19 AMYousaf Nabi (pactflow.io)
Nathan Farmer
10/27/2023, 12:49 PMPACT_URL
in this snippet represent?Nathan Farmer
10/27/2023, 3:15 PMKsawery Karwacki
10/27/2023, 11:32 PMfeature/abc
containing first contract between two services. I cannot merge consumer as it will fail can-i-deploy
(provider supporting contract is not yet deployed on target environment). If I merge provider it won't record deployment as contract selector looks for main branch and release/deployed pacts. Pending pacts and WIP pacts won't help as this contract was already verified from branch so selector returns no contracts when run from main branch after merge, it won't fail build just because the annotation @IgnoreNoPactsToVerify
. It seems that I have to manually verify against branch feature/abc
, rerun deployment pipeline to register deployment and then I can start merging consumer. Is there any valid way to do that without the need to manually running verification or hardcoding branch feature/abc
in the selector?
Did I miss something?Rafa
10/30/2023, 3:25 PMOrderRequested
message.
In Pact, the code of the providers has to be merged first, and the code of the consumer after it. This makes sense to me but I'm struggling to see if it also makes sense for event-driven architecture. If we merged Basket Service
first, there would be errors (or at least a queue of messages) because Payment Service
, the consumer, doesn't understand the new changes introduced by the provider.
For me, in this case, we would introduce some code to the consumer to be able to handle both the old and new versions of the OrderRequested
message, and after that, we'd merge the code to Basket Service
.
How would you handle this scenario, please?
Was it clear enough?
Thanks!Kiran Patel
11/01/2023, 10:43 PMOpenAPISpecification
for the consumers and validating the tests request/response against the OpenAPISpecification
using simple library like this ? doesn't it gives the same schema-based validation same as the bidirectional contract verification ?sivaganesh sivakumar
11/02/2023, 1:20 PMpactfoundation/pact-cli:latest
How to run a pact message provider test by using the docker image ? There is a verifier command but no mention about how to run message provider pact test. Any pointers please ?ian lutz
11/16/2023, 4:00 AMGuo Zhang Liew
11/20/2023, 11:06 PMRadek Stolarczyk
11/21/2023, 11:35 AM@ExtendWith(PactConsumerTestExt.class)
@PactTestFor(providerName = "ProviderCDCT",
providerType = ProviderType.ASYNCH,
pactVersion = PactSpecVersion.V3)
public class ConsumerContractTest {
@Pact(consumer = "ConsumerCDCT")
public MessagePact createMyPact(MessagePactBuilder builder) {
Map<String, String> metadata = new HashMap<>();
metadata.put("content-type", "application/json");
DslPart sqsBody = new PactDslJsonBody()
.stringType("messageId", "1")
.stringValue("receiptHandle", "testRadek")
.stringType("eventSource", "aws:sqs")
.stringType("awsRegion", "us-east-1")
.object("messageAttributes")
.closeObject();
return builder
.expectsToReceive("a message with information")
.withMetadata(metadata)
.withContent(sqsBody)
.toPact();
}
//This method is needed to create the pact files.
@Test
@PactTestFor(pactMethod = "createMyPact")
public void testMyMethod(List<Message> messages) {
}
}
My Provider Class:
@PactBroker(scheme = "https", host = "",
authentication = @PactBrokerAuth(token = ""))
@Provider("ProviderCDCT")
@Consumer("ConsumerCDCT")
public class ProviderContractTest {
private final ObjectMapper objectMapper = new ObjectMapper();
@BeforeEach
public void setUp(PactVerificationContext context) {
context.setTarget(new MessageTestTarget(List.of("Provider")));
System.setProperty("pact.verifier.publishResults",
System.getenv("PACT_BROKER_PUBLISH_VERIFICATION_RESULTS") == null ? "true" : "true");
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void testTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
@PactVerifyProvider("a message with information")
public MessageAndMetadata providerMessage() throws Exception {
Map<String, String> metadata = new HashMap<>();
metadata.put("content-type", "application/json");
Map<String, Object> mainMessage = new HashMap<>();
mainMessage.put("messageId", "");
mainMessage.put("receiptHandle", "testRadek");
mainMessage.put("eventSource", "aws:sqs");
mainMessage.put("awsRegion", "us-east-1");
mainMessage.put("messageAttributes", new HashMap<>());
return new MessageAndMetadata(objectMapper.writeValueAsBytes(mainMessage), metadata);
}
}
Slackbot
11/21/2023, 11:35 AMMark Ambrazhevich
11/23/2023, 1:08 PMJulie Røsok
11/24/2023, 8:51 AMAdam Schaff
11/24/2023, 3:58 PMYousaf Nabi (pactflow.io)
Pratibha Kachi
11/27/2023, 11:14 PMMatt (pactflow.io / pact-js / pact-go)
Stanislav Vodetskyi
11/29/2023, 1:55 AM{
"id": "x123",
"url": "<https://example.com/api/v1/entity/x123>",
"fullName": "entity-x123"
}
How can this be modeled in pact? If each field just specifies a regex like x\d+
or smth, and x123
as an example, is this enough?Jo Laing
11/30/2023, 1:35 PM