Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit d602b5e

Browse files
chore(webhook): Add test to check issue #2861 (#2881)
* chore(webhook): Add unit test to check issue #2861 * format * format --------- Co-authored-by: GuptaNavdeep1983 <[email protected]>
1 parent ea79b70 commit d602b5e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: modules/webhook/lambdas/webhook/src/webhook/handler.test.ts

+25
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,31 @@ describe('handler', () => {
239239
expect(sendActionRequest).toBeCalled();
240240
});
241241

242+
it('Check webhook does not accept jobs where not all labels are supported (single matcher).', async () => {
243+
process.env.RUNNER_CONFIG = JSON.stringify([
244+
{
245+
...queuesConfig[0],
246+
matcherConfig: {
247+
labelMatchers: [['self-hosted', 'x64', 'linux']],
248+
exactMatch: true,
249+
},
250+
},
251+
]);
252+
const event = JSON.stringify({
253+
...workflowjob_event,
254+
workflow_job: {
255+
...workflowjob_event.workflow_job,
256+
labels: ['self-hosted', 'linux', 'x64', 'on-demand'],
257+
},
258+
});
259+
const resp = await handle(
260+
{ 'X-Hub-Signature': await webhooks.sign(event), 'X-GitHub-Event': 'workflow_job' },
261+
event,
262+
);
263+
expect(resp.statusCode).toBe(202);
264+
expect(sendActionRequest).not.toBeCalled;
265+
});
266+
242267
it('Check webhook does not accept jobs where not all labels are supported by the runner.', async () => {
243268
process.env.RUNNER_CONFIG = JSON.stringify([
244269
{

0 commit comments

Comments
 (0)