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 6, 2024
1 parent 33d6060 commit 707028f
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 grpc_client = native.connect(__ENV.GRPC_ENDPOINT, '', 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 707028f

Please sign in to comment.