本文整理汇总了Golang中github.com/tsuru/tsuru/fs/testing.RecordingFs.Create方法的典型用法代码示例。如果您正苦于以下问题:Golang RecordingFs.Create方法的具体用法?Golang RecordingFs.Create怎么用?Golang RecordingFs.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/fs/testing.RecordingFs
的用法示例。
在下文中一共展示了RecordingFs.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestGetSSHCommandsDefaultKeyFile
func (s *S) TestGetSSHCommandsDefaultKeyFile(c *gocheck.C) {
rfs := ftesting.RecordingFs{}
f, err := rfs.Create(os.ExpandEnv("${HOME}/.ssh/id_rsa.pub"))
c.Assert(err, gocheck.IsNil)
f.Write([]byte("ssh-rsa ohwait! [email protected]"))
f.Close()
old := fsystem
fsystem = &rfs
defer func() {
fsystem = old
}()
commands, err := sshCmds()
c.Assert(err, gocheck.IsNil)
c.Assert(commands[0], gocheck.Equals, "/var/lib/tsuru/add-key ssh-rsa ohwait! [email protected]")
}
示例2: TestGetSSHCommandsDefaultSSHDPath
func (s *S) TestGetSSHCommandsDefaultSSHDPath(c *gocheck.C) {
rfs := ftesting.RecordingFs{}
f, err := rfs.Create("/opt/me/id_dsa.pub")
c.Assert(err, gocheck.IsNil)
f.Write([]byte("ssh-rsa ohwait! [email protected]"))
f.Close()
old := fsystem
fsystem = &rfs
defer func() {
fsystem = old
}()
config.Set("docker:ssh:public-key", "/opt/me/id_dsa.pub")
defer config.Unset("docker:ssh:public-key")
commands, err := sshCmds()
c.Assert(err, gocheck.IsNil)
c.Assert(commands[1], gocheck.Equals, "sudo /usr/sbin/sshd -D")
}