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 Jul 18, 2024
1 parent 06ea8dc commit 146142d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scenarios/grpc_search.js
Original file line number Diff line number Diff line change
@@ -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;
}
}
)
}

0 comments on commit 146142d

Please sign in to comment.