- Added AccessControl to ComboHandler for role-based access management. - Implemented gas estimation for plan execution and improved gas limit checks. - Updated execution and preparation methods to enforce step count limits and role restrictions. - Enhanced error handling in orchestrator API endpoints with AppError for better validation feedback. - Integrated request timeout middleware for improved request management. - Updated Swagger documentation to reflect new API structure and parameters.
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import http from 'k6/http';
|
|
import { check, sleep } from 'k6';
|
|
|
|
export const options = {
|
|
stages: [
|
|
{ duration: '30s', target: 20 },
|
|
{ duration: '1m', target: 50 },
|
|
{ duration: '30s', target: 0 },
|
|
],
|
|
thresholds: {
|
|
http_req_duration: ['p(95)<500'],
|
|
http_req_failed: ['rate<0.01'],
|
|
},
|
|
};
|
|
|
|
export default function () {
|
|
const BASE_URL = __ENV.ORCH_URL || 'http://localhost:8080';
|
|
|
|
// Test plan creation
|
|
const planPayload = JSON.stringify({
|
|
creator: 'test-user',
|
|
steps: [
|
|
{ type: 'borrow', asset: 'CBDC_USD', amount: 100000 },
|
|
],
|
|
});
|
|
|
|
const createRes = http.post(`${BASE_URL}/api/plans`, planPayload, {
|
|
headers: { 'Content-Type': 'application/json' },
|
|
});
|
|
|
|
check(createRes, {
|
|
'plan created': (r) => r.status === 201,
|
|
'response time < 500ms': (r) => r.timings.duration < 500,
|
|
});
|
|
|
|
if (createRes.status === 201) {
|
|
const planId = JSON.parse(createRes.body).plan_id;
|
|
|
|
// Test getting plan
|
|
const getRes = http.get(`${BASE_URL}/api/plans/${planId}`);
|
|
check(getRes, {
|
|
'plan retrieved': (r) => r.status === 200,
|
|
});
|
|
}
|
|
|
|
sleep(1);
|
|
}
|
|
|