MCPcopy
hub / github.com/perkeep/perkeep / testInsertTooLarge

Function testInsertTooLarge

pkg/sorted/kvtest/kvtest.go:167–186  ·  view source on GitHub ↗
(t *testing.T, kv sorted.KeyValue)

Source from the content-addressed store, hash-verified

165}
166
167func testInsertTooLarge(t *testing.T, kv sorted.KeyValue) {
168 largeKey := make([]byte, sorted.MaxKeySize+1)
169 largeValue := make([]byte, sorted.MaxValueSize+1)
170 err := kv.Set(string(largeKey), "whatever")
171 if err != nil {
172 t.Fatalf("Insertion of too large a key should have skipped with some logging, but err was %v", err)
173 }
174 _, err = kv.Get(string(largeKey))
175 if err == nil {
176 t.Fatal("large key should not have been inserted")
177 }
178 err = kv.Set("testInsertTooLarge", string(largeValue))
179 if err != nil {
180 t.Fatalf("Insertion of too large a value should have skipped with some logging, but err was %v", err)
181 }
182 _, err = kv.Get("testInsertTooLarge")
183 if err == nil {
184 t.Fatal("large value should not have been inserted")
185 }
186}
187
188func testEnumerate(t *testing.T, kv sorted.KeyValue, start, end string, want ...string) {
189 var got []string

Callers 1

TestSortedFunction · 0.85

Calls 4

FatalMethod · 0.80
SetMethod · 0.65
FatalfMethod · 0.65
GetMethod · 0.65

Tested by 1

TestSortedFunction · 0.68