test: Add a blob replication test that succeeds for all the wrong reasons.
This commit is contained in:
@@ -1128,6 +1128,11 @@ void tf_ssb_test_replicate(const tf_test_options_t* options)
|
||||
tf_printf("%s user %d = %s private=%s\n", added ? "added" : "failed", i, public[i], private[i]);
|
||||
}
|
||||
|
||||
char blob_id[k_id_base64_len] = { 0 };
|
||||
const char* k_blob = "Hello, new blob!";
|
||||
b = tf_ssb_db_blob_store(ssb0, (const uint8_t*)k_blob, strlen(k_blob), blob_id, sizeof(blob_id), NULL);
|
||||
assert(b);
|
||||
|
||||
JSContext* context0 = tf_ssb_get_context(ssb0);
|
||||
for (int i = 0; i < k_key_count - 1; i++)
|
||||
{
|
||||
@@ -1152,6 +1157,7 @@ void tf_ssb_test_replicate(const tf_test_options_t* options)
|
||||
obj = JS_NewObject(context0);
|
||||
JS_SetPropertyStr(context0, obj, "type", JS_NewString(context0, "post"));
|
||||
JS_SetPropertyStr(context0, obj, "text", JS_NewString(context0, "Hello, world!"));
|
||||
JS_SetPropertyStr(context0, obj, "arbitrary_reference", JS_NewString(context0, blob_id));
|
||||
stored = false;
|
||||
signed_message = tf_ssb_sign_message(ssb0, self, private_bin, obj, NULL, 0);
|
||||
tf_ssb_verify_strip_and_store_message(ssb0, signed_message, _message_stored, &stored);
|
||||
@@ -1213,6 +1219,15 @@ void tf_ssb_test_replicate(const tf_test_options_t* options)
|
||||
tf_ssb_remove_message_added_callback(ssb1, _message_added, &count1);
|
||||
tf_printf("done\n");
|
||||
|
||||
tf_printf("Waiting for blob.\n");
|
||||
while (!tf_ssb_db_blob_get(ssb0, blob_id, NULL, NULL))
|
||||
{
|
||||
tf_ssb_set_main_thread(ssb1, true);
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
tf_ssb_set_main_thread(ssb1, false);
|
||||
}
|
||||
tf_printf("done\n");
|
||||
|
||||
tf_ssb_send_close(ssb1);
|
||||
|
||||
uv_close((uv_handle_t*)&idle0, NULL);
|
||||
|
Reference in New Issue
Block a user