Zeus
09/23/2022, 8:32 AMRuby
(Consumer)
B -> microservice which is written in GoLang
(Producer)
Do I need to use pact-ruby
and pact-go
on consumer and producer side respectively?
Is there anything in addition I should before introducing the pact contract tests?tmegha
09/23/2022, 9:13 AMThomas K
09/25/2022, 6:43 PMrecording deployments and releases
on the provider side.
When we deploy the provider to an environment (e.g. staging
), it is deployed to multiple staging
k8s clusters. Should something like application instances
be considered for deployment of the provider app into each cluster when recording deployment in the pact broker?
We were looking at doing the record-deployment/release
command on provider side as a helm post-install job, but then the command I guess would be run for deployment to every cluster, but I imagine we maybe only need the command called once for the deployment to staging
environment, rather than for each staging
cluster ?
Would really appreciate any tips on correct approach here. We were looking at this helm post-install hook approach as this better ensures that deployment (to a cluster etc) was actually successful before we run the record-deployment
commandMaksym Liannoi
09/27/2022, 10:12 AM"application/octet-stream"
(pact-js library) and verification on the provider side with C# language (pact-net library)? Because of many of my attempts, the response is 200 on the provider side, but when I try to test HTTP 400 Bad Request, I cannot find a suitable withRequest
body for that test.
test("...", async () => {
const badRequestData = {
error: {
code: "validationError",
message: "Validation error(s) has occurred",
details: [],
},
};
const badRequestResponse = somethingLike({
error: {
code: like(badRequestData.error.code),
message: like(badRequestData.error.message),
details: like(badRequestData.error.details),
},
});
const status = 400;
await provider.addInteraction({
state: "...",
uponReceiving: "...",
withRequest: { method, headers, path, body: "\u0000" },
willRespondWith: { status, body: badRequestResponse },
});
expect.assertions(3);
try {
await testService.sendContent(mailboxId, content);
} catch (e) {
checkIfHttpError(e, status);
expect((e as AxiosError).response?.data).toStrictEqual(badRequestData);
}
});
[ApiController]
[Route("test")]
public class TestController : ControllerBase
{
private readonly ITestService _testService;
public TestController(ITestService testService)
{
_testService = testService;
}
[HttpPost("...")]
[Authorize(...)]
[Produces("application/json")]
[Consumes("application/octet-stream")]
[ProducesResponseType(type: typeof(TestResponse), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<TestResponse> HandleAsync(string id, [FromQuery(Name = "fileName")] string? fileName)
{
if (Request.ContentLength == 0)
{
throw new InvalidArgumentException("Request body should not be empty");
}
var messageId = await _testService.HandleAsync(id: id.ToLower().Trim(), fileName, Request.Body);
return new TestResponse(messageId);
}
}
Matt (pactflow.io / pact-js / pact-go)
Slackbot
09/27/2022, 11:00 AMZeus
09/27/2022, 11:12 AMHazem Borham
09/27/2022, 8:46 PM{
picklists: atLeastOneLike([
{id: 1, name: 'She/Her'},
{id: 2, name: 'He/Him'},
{id: 3, name: 'They/Them'},
{id: 4, name: 'Other'},
])
}
so that the generated stub response for the consumer definition is:
{
picklists: [
{id: 1, name: 'She/Her'},
{id: 2, name: 'He/Him'},
{id: 3, name: 'They/Them'},
{id: 4, name: 'Other'},
]
}
and the generated matcher for the provider is:
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.picklists": {
"combine": "AND",
"matchers": [
{
"match": "type",
"min": 1
}
]
}
},
Dmitry Munda
09/28/2022, 11:35 AMNoor Hashem
09/28/2022, 1:07 PMShuo Yang
09/28/2022, 7:53 PMShuo Yang
09/28/2022, 8:00 PMAlan Zhu
09/30/2022, 9:31 AMThai Le
09/30/2022, 4:46 PMAshok
10/03/2022, 10:25 AMThomas K
10/03/2022, 1:38 PMpact-broker create-webhook <https://api.github.com/repos/ORG/REPO/dispatches> \
> --header=Authorization Bearer $PAT \
> --request=POST \
> --consumer=ConsumerApp \
> --provider=ProviderService \
> --contract-requiring-verification-published
In my output I got Webhook "POST <http://api.github.com|api.github.com>" created
but no UUID, this is using the ruby pact-cli
...
When I try via docker run, I get the same output without any UUID, can anyone help please or know why?Thomas K
10/03/2022, 1:51 PM/webhooks
Thomas K
10/03/2022, 9:24 PMYousaf Nabi (pactflow.io)
Noor Hashem
10/05/2022, 6:13 PMZeus
10/06/2022, 7:09 AMMatteo
10/11/2022, 12:12 PMPhillip Lo
10/11/2022, 4:21 PMStefan Tertan
10/13/2022, 9:50 AMAlan Zhu
10/17/2022, 12:40 PMPhillip Lo
10/18/2022, 8:09 PMShirley
10/19/2022, 8:11 AMShirley
10/19/2022, 8:13 AMNerea
10/19/2022, 1:01 PMNoor Hashem
10/19/2022, 4:11 PM