From 146142d3e2e3c54525a43f811048e037afa5f306 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 18 Jul 2024 23:50:29 +0300 Subject: [PATCH] scenarios/grpc: add simple search example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It does what it claims, however, it may be adjusted to real requirements in the future. Controlled by a number of iterations and number of virtual users. Searches for objects with `test=test` attributes. Closes #90. Run example: ``` ▶ ./xk6-neofs run -e i=200 -e vu=1 -e cid=FB6UeNbx65iHuNKNbGsb2xHxooU7kXangaUxv9P6h9uW -e GRPC_ENDPOINT=s01.neofs.devenv:8080 scenarios/grpc_search.js ``` Signed-off-by: Pavel Karpy --- scenarios/grpc_search.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scenarios/grpc_search.js diff --git a/scenarios/grpc_search.js b/scenarios/grpc_search.js new file mode 100644 index 0000000..cdfac14 --- /dev/null +++ b/scenarios/grpc_search.js @@ -0,0 +1,32 @@ +import { check } from 'k6'; +import native from 'k6/x/neofs/native'; + +const grpc_client = native.connect(__ENV.GRPC_ENDPOINT, '', 5, 15); +const container = __ENV.cid + +export const options = { + scenarios: { + system_write: { + executor: 'shared-iterations', + vus: __ENV.vu, + iterations: __ENV.i, + exec: 'search', + maxDuration: (24*365*100).toString()+"h", // default is 10m and this load is designed to be controlled by iterations only + gracefulStop: '30s', + }, + }, +}; + +export function search() { + let res = grpc_client.search(container, [{ + key: "test", + operation: "STRING_EQUAL", + value: "test" + }]) + check(res, { + 'search': (r) => { + return r > 0; + } + } + ) +}