rc: Add operations/fsinfo: Return information about the remote

This returns a information about the remote including Name, Root,
Hashes and optional Features.
This commit is contained in:
Nick Craig-Wood
2019-06-08 09:19:07 +01:00
parent e1cf551ded
commit 454dfd3c9e
4 changed files with 164 additions and 1 deletions

View File

@@ -1182,3 +1182,23 @@ func TestDirMove(t *testing.T) {
)
}
func TestGetFsInfo(t *testing.T) {
r := fstest.NewRun(t)
defer r.Finalise()
f := r.Fremote
info := operations.GetFsInfo(f)
assert.Equal(t, f.Name(), info.Name)
assert.Equal(t, f.Root(), info.Root)
assert.Equal(t, f.String(), info.String)
assert.Equal(t, f.Precision(), info.Precision)
hashSet := hash.NewHashSet()
for _, hashName := range info.Hashes {
var ht hash.Type
require.NoError(t, ht.Set(hashName))
hashSet.Add(ht)
}
assert.Equal(t, f.Hashes(), hashSet)
assert.Equal(t, f.Features().Enabled(), info.Features)
}