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