index: move dump to a method

Change-Id: I784bca14185db9eb255b0d6adc96adddc721cd02
This commit is contained in:
Brad Fitzpatrick 2011-11-27 13:37:59 -05:00
parent baf8a13918
commit d1fc9afec0
1 changed files with 13 additions and 7 deletions

View File

@ -35,6 +35,18 @@ type IndexDeps struct {
SignerBlobRef *blobref.BlobRef
}
func (id *IndexDeps) dumpIndex(t *testing.T) {
t.Logf("Begin index dump:")
it := id.Index.s.Find("")
for it.Next() {
t.Logf(" %q = %q", it.Key(), it.Value())
}
if err := it.Close(); err != nil {
t.Fatalf("iterator close = %v", err)
}
t.Logf("End index dump.")
}
func (id *IndexDeps) uploadAndSignMap(m map[string]interface{}) *blobref.BlobRef {
m["camliSigner"] = id.SignerBlobRef
unsigned, err := schema.MapToCamliJson(m)
@ -99,13 +111,7 @@ func TestIndexPopulation(t *testing.T) {
id := NewIndexDeps()
pn := id.NewPermanode()
t.Logf("uploaded permanode %q", pn)
it := id.Index.s.Find("")
for it.Next() {
t.Logf(" %q = %q", it.Key(), it.Value())
}
if err := it.Close(); err != nil {
t.Fatalf("iterator close = %v", err)
}
id.dumpIndex(t)
}
func TestReverseTimeString(t *testing.T) {