MCPcopy Index your code
hub / github.com/perkeep/perkeep / handlerDescribeTestSetupWithEmbeddedRefs

Function handlerDescribeTestSetupWithEmbeddedRefs

pkg/search/handler_test.go:256–291  ·  view source on GitHub ↗

extends handlerDescribeTestSetup but adds various embedded references to other nodes. lastModtime is at test.ClockOrigin + 14s on return.

(t *testing.T)

Source from the content-addressed store, hash-verified

254// extends handlerDescribeTestSetup but adds various embedded references to other nodes.
255// lastModtime is at test.ClockOrigin + 14s on return.
256func handlerDescribeTestSetupWithEmbeddedRefs(t *testing.T) indexAndOwner {
257 ixo := handlerDescribeTestSetup(t)
258 idx := ixo.index
259 tf := idx.KeyFetcher.(*test.Fetcher)
260 fi := &fetcherIndex{
261 tf: tf,
262 idx: idx,
263 }
264
265 perma123 := testBlobs["perma-123"]
266 c1 := testBlobs["fakeref-01"]
267 checkErr(t, fi.addBlob(c1))
268 c2 := testBlobs["fakeref-02"]
269 checkErr(t, fi.addBlob(c2))
270 c3 := testBlobs["fakeref-03"]
271 checkErr(t, fi.addBlob(c3))
272 c4 := testBlobs["fakeref-04"]
273 checkErr(t, fi.addBlob(c4))
274 c5 := testBlobs["fakeref-05"]
275 checkErr(t, fi.addBlob(c5))
276 c6 := testBlobs["fakeref-06"]
277 checkErr(t, fi.addBlob(c6))
278
279 lastModtime = test.ClockOrigin.Add(8 * time.Second).UTC()
280 checkErr(t, fi.addClaim(schema.NewSetAttributeClaim(perma123.BlobRef(), c1.BlobRef().String(), "foo")))
281 checkErr(t, fi.addClaim(schema.NewSetAttributeClaim(perma123.BlobRef(), "foo,"+c2.BlobRef().String()+"=bar", "foo")))
282 checkErr(t, fi.addClaim(schema.NewSetAttributeClaim(perma123.BlobRef(), "foo:"+c3.BlobRef().String()+"?bar,"+c4.BlobRef().String(), "foo")))
283 checkErr(t, fi.addClaim(schema.NewSetAttributeClaim(perma123.BlobRef(), "foo", c5.BlobRef().String())))
284 checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "bar", "baz")))
285 checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "bar", "monkey\n"+c6.BlobRef().String())))
286
287 return indexAndOwner{
288 index: idx,
289 owner: owner.BlobRef(),
290 }
291}
292
293func tbRefStr(name string) string {
294 tb, ok := testBlobs[name]

Callers

nothing calls this directly

Calls 9

addBlobMethod · 0.95
addClaimMethod · 0.95
NewSetAttributeClaimFunction · 0.92
NewAddAttributeClaimFunction · 0.92
handlerDescribeTestSetupFunction · 0.85
checkErrFunction · 0.85
BlobRefMethod · 0.65
AddMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected