1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
10 "git.curoverse.com/arvados.git/sdk/go/arvadostest"
11 check "gopkg.in/check.v1"
14 var _ = check.Suite(&SiteFSSuite{})
16 type SiteFSSuite struct {
22 func (s *SiteFSSuite) SetUpTest(c *check.C) {
23 s.client = NewClientFromEnv()
24 s.kc = &keepClientStub{
25 blocks: map[string][]byte{
26 "3858f62230ac3c915f300c664312c63f": []byte("foobar"),
28 s.fs = s.client.SiteFileSystem(s.kc)
31 func (s *SiteFSSuite) TestHttpFileSystemInterface(c *check.C) {
32 _, ok := s.fs.(http.FileSystem)
33 c.Check(ok, check.Equals, true)
36 func (s *SiteFSSuite) TestByIDEmpty(c *check.C) {
37 f, err := s.fs.Open("/by_id")
38 c.Assert(err, check.IsNil)
39 fis, err := f.Readdir(-1)
40 c.Check(len(fis), check.Equals, 0)
43 func (s *SiteFSSuite) TestByUUID(c *check.C) {
44 f, err := s.fs.Open("/by_id")
45 c.Assert(err, check.IsNil)
46 fis, err := f.Readdir(-1)
47 c.Check(err, check.IsNil)
48 c.Check(len(fis), check.Equals, 0)
50 f, err = s.fs.Open("/by_id/" + arvadostest.FooCollection)
51 c.Assert(err, check.IsNil)
52 fis, err = f.Readdir(-1)
54 for _, fi := range fis {
55 names = append(names, fi.Name())
57 c.Check(names, check.DeepEquals, []string{"foo"})