Skip to content

Commit

Permalink
t-reftable-readwrite: add test for known error
Browse files Browse the repository at this point in the history
When using reftable_writer_add_ref() to add a ref record to a
reftable writer, The update_index of the ref record must be within
the limits set by reftable_writer_set_limits(), or REFTABLE_API_ERROR
is returned. This scenario is currently left untested. Add a test
case for the same.

Mentored-by: Patrick Steinhardt <[email protected]>
Mentored-by: Christian Couder <[email protected]>
Signed-off-by: Chandra Pratap <[email protected]>
  • Loading branch information
Chandra Pratap committed Aug 12, 2024
1 parent 9194a40 commit d34b01f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions t/unit-tests/t-reftable-readwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ static void t_write_key_order(void)
check(!err);
err = reftable_writer_add_ref(w, &refs[1]);
check_int(err, ==, REFTABLE_API_ERROR);

refs[0].update_index = 2;
err = reftable_writer_add_ref(w, &refs[0]);
check_int(err, ==, REFTABLE_API_ERROR);

reftable_writer_close(w);
reftable_writer_free(w);
strbuf_release(&buf);
Expand Down

0 comments on commit d34b01f

Please sign in to comment.