本文整理匯總了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")
}