Skip to content
quarry Artifact [61eb5dace6]
Login

Artifact [61eb5dace6]

Artifact 61eb5dace6ca54430eedb08d78e73c18034bbff4a35fba85f2d04f4fff478079:


package index

import "testing"

// The start of a watermark walk over a repository that had nothing when
// the walk began: the earliest arrivals, oldest first.
func TestOldestCheckinsStartsAtTheBeginning(t *testing.T) {
	ix := openIndex(t)
	if got, err := ix.OldestCheckins(10); err != nil || len(got) != 0 {
		t.Fatalf("FAIL: empty repository = %v, %v", got, err)
	}
	ci(t, ix, "c1", "trunk", "2026-01-01T00:00:00", "first")
	ci(t, ix, "c2", "trunk", "2026-01-02T00:00:00", "second", "c1")
	ci(t, ix, "c3", "side", "2026-01-03T00:00:00", "third", "c2")
	got, err := ix.OldestCheckins(2)
	if err != nil {
		t.Fatal(err)
	}
	if len(got) != 2 || got[0].Hash != "c1" || got[1].Hash != "c2" {
		t.Fatalf("FAIL: OldestCheckins(2) = %v", got)
	}
	if got[0].Branch != "trunk" || got[0].Comment != "first" {
		t.Errorf("FAIL: row not filled: %+v", got[0])
	}
}