1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
13 check "gopkg.in/check.v1"
16 var _ = check.Suite(&CmdSuite{})
18 type CmdSuite struct {
22 func (s *CmdSuite) SetUpTest(c *check.C) {
23 tmpdir, err := ioutil.TempDir("", "")
24 c.Assert(err, check.IsNil)
28 func (s *CmdSuite) TearDownTest(c *check.C) {
29 c.Check(os.RemoveAll(s.mnt), check.IsNil)
32 func (s *CmdSuite) TestMount(c *check.C) {
33 exited := make(chan int)
34 stdin := bytes.NewBufferString("stdin")
35 stdout := bytes.NewBuffer(nil)
36 stderr := bytes.NewBuffer(nil)
37 mountCmd := cmd{ready: make(chan struct{})}
40 exited <- mountCmd.RunCommand("test mount", []string{"--experimental", s.mnt}, stdin, stdout, stderr)
45 ok := mountCmd.Unmount()
46 c.Check(ok, check.Equals, true)
49 case <-time.After(5 * time.Second):
51 case errCode, ok := <-exited:
52 c.Check(ok, check.Equals, true)
53 c.Check(errCode, check.Equals, 0)
55 c.Check(ready, check.Equals, true)
56 c.Check(stdout.String(), check.Equals, "")
57 // stdin should not have been read
58 c.Check(stdin.String(), check.Equals, "stdin")