]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t-reftable-readwrite: add test for known error
authorChandra Pratap <chandrapratap3519@gmail.com>
Tue, 13 Aug 2024 14:34:50 +0000 (20:04 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2024 17:08:03 +0000 (10:08 -0700)
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 <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-reftable-readwrite.c

index 9a05dde9d6d39dfbb8c714a01fb98a1abc387ce8..2ce56a052377face72d3df823312b082b72547c7 100644 (file)
@@ -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);