Skip to content

Commit

Permalink
scenarios/grpc: add simple search example
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
carpawell committed Aug 9, 2024
1 parent d836981 commit abecf3c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scenarios/grpc_search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { check } from 'k6';
import native from 'k6/x/neofs/native';

const dial_timeout = 5
const stream_timeout = 15
const predefined_private_key = '' // usually no need for search requests in load tests
const grpc_client = native.connect(__ENV.GRPC_ENDPOINT, predefined_private_key, dial_timeout, stream_timeout);
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;
}
}
)
}

0 comments on commit abecf3c

Please sign in to comment.