Skip to content

Commit a846f1f

Browse files
committed
improve tests
1 parent e66450a commit a846f1f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/courses/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ async fn event_listener(pool: sqlx::PgPool, event_store: EventStore) -> Result<(
7474
read_model::ReadModelProjection::try_new(pool).await?,
7575
PgEventListenerConfig::poller(Duration::from_secs(5))
7676
.with_notifier()
77+
.fetch_size(100)
7778
.with_retry(handle_read_model_retry),
7879
)
7980
.start_with_shutdown(shutdown())

examples/courses/tests/subscriptions_concurrency_test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import grpc from 'k6/net/grpc';
22
import { check, sleep } from 'k6';
33

44
const serverUrl = 'localhost:10437';
5-
const COURSES = 10;
65
const USERS = 500;
6+
const COURSES = 10;
7+
const STUDENTS = 500;
78

89
const COURSE_ID_PREFIX = 'course';
910
const STUDENT_ID_PREFIX = 'student';
1011

1112
export let options = {
1213
vus: USERS,
13-
duration: '100s',
14+
duration: '60s',
1415
};
1516

1617
const client = new grpc.Client();
@@ -29,7 +30,7 @@ export function setup() {
2930
check(res, { 'course created': (r) => r && r.status === grpc.StatusOK });
3031
}
3132
// Register students
32-
for (let i = 1; i <= USERS; i++) {
33+
for (let i = 1; i <= STUDENTS; i++) {
3334
const student = {
3435
student_id: `${STUDENT_ID_PREFIX}${i}`,
3536
name: `Student ${i}`,
@@ -44,7 +45,7 @@ export function setup() {
4445
export default function(data) {
4546
client.connect(serverUrl, { plaintext: true });
4647
const course_id = Math.floor(Math.random() * COURSES) + 1;
47-
const student_id = Math.floor(Math.random() * USERS) + 1;
48+
const student_id = Math.floor(Math.random() * STUDENTS) + 1;
4849
const subscription = {
4950
course_id: `${COURSE_ID_PREFIX}${course_id}`,
5051
student_id: `${STUDENT_ID_PREFIX}${student_id}`,

0 commit comments

Comments
 (0)