pull:初次提交
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"type": "httpBearerAuth",
|
||||
"name": "Dummy HTTP credential",
|
||||
"data": {
|
||||
"token": "dummy token"
|
||||
},
|
||||
"id": "0fqzOReozl2aQvtl"
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
{
|
||||
"name": "Credential HTTP Request",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "benchmark-credential-http-node",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2,
|
||||
"position": [-64, 32],
|
||||
"id": "7dd66dcc-03c7-4898-ab3d-d2765730e3f3",
|
||||
"name": "Webhook",
|
||||
"webhookId": "92b141cd-6e59-4425-9c0a-e2ee0f4faad2"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "allIncomingItems",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.1,
|
||||
"position": [1072, 32],
|
||||
"id": "e074e6a7-2417-4fde-8b6b-bc68069e833b",
|
||||
"name": "Respond to Webhook"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://mockapi:8080/users/clair.bahringer/received_events/public",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {
|
||||
"response": {
|
||||
"response": {
|
||||
"fullResponse": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [304, -176],
|
||||
"id": "28ddbbf9-56a5-431e-afe9-3c44b21aa676",
|
||||
"name": "Mock public received events",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "0fqzOReozl2aQvtl",
|
||||
"name": "Dummy HTTP credential"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://mockapi:8080/repos/udke6pujoywnagxkcvab2riw23khzn2tibo2vincws32qexb50ey7h97d42vnzyol0rxypgsg4pomsf7sgnmdaihstljw8edcijrwmy7mfi76yif19c4/47i31dh737el215j62ts2f2782nw3ss26rul3s8jw13u3vu0xm349a5hyay5asmwnlnf7nx8p9h4g62so6s1cis7xv9puj5j98t4m980sbe2455fn1obccjl/events",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {
|
||||
"response": {
|
||||
"response": {
|
||||
"fullResponse": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [304, 32],
|
||||
"id": "3ce8827c-6226-467e-a4da-9891c1acd863",
|
||||
"name": "Mock repository events",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "0fqzOReozl2aQvtl",
|
||||
"name": "Dummy HTTP credential"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://mockapi:8080/orgs/g02pp066qoyithcjevhd6m1wfii3c4x51k39n9apybljhx69/events",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {
|
||||
"response": {
|
||||
"response": {
|
||||
"fullResponse": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [304, 224],
|
||||
"id": "a8e416ab-50cc-4e50-8d9a-9fcf5d4bbdc8",
|
||||
"name": "Mock organization events",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "0fqzOReozl2aQvtl",
|
||||
"name": "Dummy HTTP credential"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"numberInputs": 3
|
||||
},
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"typeVersion": 3,
|
||||
"position": [608, 32],
|
||||
"id": "542a27d4-3a03-4c22-a79a-7266050c519e",
|
||||
"name": "Merge"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "89608adb-f487-416f-a7d8-3ebb1f7b50e5",
|
||||
"name": "statusCode",
|
||||
"value": "={{ $json.statusCode }}",
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "35d4bfbb-d4be-49f4-a5dd-bd5c67a48200",
|
||||
"name": "Select statusCode",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [832, 32]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Webhook": [
|
||||
{
|
||||
"json": {
|
||||
"headers": {
|
||||
"host": "localhost:5678",
|
||||
"user-agent": "curl/8.6.0",
|
||||
"accept": "*/*"
|
||||
},
|
||||
"params": {},
|
||||
"query": {},
|
||||
"body": {},
|
||||
"webhookUrl": "http://localhost:5678/webhook-test/benchmark-credential-http-node",
|
||||
"executionMode": "test"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Mock public received events",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Mock repository events",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Mock organization events",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Mock public received events": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Mock repository events": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Mock organization events": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 2
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Select statusCode",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Select statusCode": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Webhook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "96bfc5ef-9421-47f5-9fdd-432dbd4bc4ca",
|
||||
"meta": {
|
||||
"instanceId": "4141065f11bd5ed73fef4f9b1d91842ded0ec4058e6640a98aa14384e269204b"
|
||||
},
|
||||
"id": "6V8rTiIDqZOniAs1",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../scenario.schema.json",
|
||||
"name": "CredentialHttpNode",
|
||||
"description": "Webhook -> 3x HTTP request to a mock API -> Merge -> Respond to Webhook. Requires a mock API running at http://mockapi:8080",
|
||||
"scenarioData": {
|
||||
"workflowFiles": ["credential-http-node.json"],
|
||||
"credentialFiles": ["credential-bearer.json"]
|
||||
},
|
||||
"scriptPath": "credential-http-node.script.js"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import http from 'k6/http';
|
||||
import { check } from 'k6';
|
||||
|
||||
const apiBaseUrl = __ENV.API_BASE_URL;
|
||||
|
||||
export default function () {
|
||||
const res = http.post(`${apiBaseUrl}/webhook/benchmark-http-node`);
|
||||
|
||||
if (res.status !== 200) {
|
||||
console.error(
|
||||
`Invalid response. Received status ${res.status}. Body: ${JSON.stringify(res.body)}`,
|
||||
);
|
||||
}
|
||||
|
||||
check(res, {
|
||||
'is status 200': (r) => r.status === 200,
|
||||
'http requests were OK': (r) => {
|
||||
if (r.status !== 200) return false;
|
||||
|
||||
try {
|
||||
// Response body is an array of the request status codes made with HttpNodes
|
||||
const body = JSON.parse(r.body);
|
||||
return Array.isArray(body) ? body.every((request) => request.statusCode === 200) : false;
|
||||
} catch (error) {
|
||||
console.error('Error parsing response body: ', error);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user