Skip to content

Commit 7d260d9

Browse files
committed
test: fix the test_failure_path to skip the fast-lane for the send operation
With the fast-lane for small payload, the cloudsync service returns immediately the error, while for bigger payloads the apply job is processed asynchronously.
1 parent dd4c7eb commit 7d260d9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/integration.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ int test_failure_path (const char *db_path) {
517517

518518
rc = open_load_ext(db_path, &db); RCHECK
519519

520-
rc = db_exec(db, "CREATE TABLE IF NOT EXISTS failure_users (id TEXT PRIMARY KEY NOT NULL, name TEXT NOT NULL DEFAULT '');"); RCHECK
520+
rc = db_exec(db, "CREATE TABLE IF NOT EXISTS failure_users (id TEXT PRIMARY KEY NOT NULL, name TEXT NOT NULL DEFAULT '', value BLOB);"); RCHECK
521521
rc = db_exec(db, "SELECT cloudsync_init('failure_users');"); RCHECK
522522

523523
char network_init[1024];
@@ -534,10 +534,12 @@ int test_failure_path (const char *db_path) {
534534
}
535535

536536
// Insert a row so cloudsync_network_send_changes has a payload to upload.
537+
// Insert a 1MB value to skip the fast-lane and force using the normal s3 path with async job,
538+
// otherwise the error would be immediately returned by the apply endpoint.
537539
char value[UUID_STR_MAXLEN];
538540
cloudsync_uuid_v7_string(value, true);
539541
char sql[256];
540-
snprintf(sql, sizeof(sql), "INSERT INTO failure_users (id, name) VALUES ('%s', '%s');", value, value);
542+
snprintf(sql, sizeof(sql), "INSERT INTO failure_users (id, name, value) VALUES ('%s', '%s', randomblob(1048576));", value, value);
541543
rc = db_exec(db, sql); RCHECK
542544

543545
// First invocation — primes the server. Failures may not yet be reported.

0 commit comments

Comments
 (0)