X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dcf97f13fa730ba7af3fee9b6d7044592a30a2be..f1827e2044aff826e63826880b296a59c4a17e2a:/services/keepstore/keepstore_test.go?ds=sidebyside diff --git a/services/keepstore/keepstore_test.go b/services/keepstore/keepstore_test.go index a6e29f4759..811cc70d3f 100644 --- a/services/keepstore/keepstore_test.go +++ b/services/keepstore/keepstore_test.go @@ -345,7 +345,7 @@ func TestDiscoverTmpfs(t *testing.T) { t.Errorf("Discover returned %s, expected %s\n", resultVols[i].(*UnixVolume).root, tmpdir) } - if expectReadonly := i % 2 == 1; expectReadonly != resultVols[i].(*UnixVolume).readonly { + if expectReadonly := i%2 == 1; expectReadonly != resultVols[i].(*UnixVolume).readonly { t.Errorf("Discover added %s with readonly=%v, should be %v", tmpdir, !expectReadonly, expectReadonly) } @@ -394,8 +394,10 @@ func TestIndex(t *testing.T) { vols[0].Put(TEST_HASH+".meta", []byte("metadata")) vols[1].Put(TEST_HASH_2+".meta", []byte("metadata")) - index := vols[0].Index("") + vols[1].Index("") - index_rows := strings.Split(index, "\n") + buf := new(bytes.Buffer) + vols[0].IndexTo("", buf) + vols[1].IndexTo("", buf) + index_rows := strings.Split(string(buf.Bytes()), "\n") sort.Strings(index_rows) sorted_index := strings.Join(index_rows, "\n") expected := `^\n` + TEST_HASH + `\+\d+ \d+\n` + @@ -405,7 +407,7 @@ func TestIndex(t *testing.T) { match, err := regexp.MatchString(expected, sorted_index) if err == nil { if !match { - t.Errorf("IndexLocators returned:\n%s", index) + t.Errorf("IndexLocators returned:\n%s", string(buf.Bytes())) } } else { t.Errorf("regexp.MatchString: %s", err)