本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem.FindFileStats方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeFileSystem.FindFileStats方法的具体用法?Golang FakeFileSystem.FindFileStats怎么用?Golang FakeFileSystem.FindFileStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.FindFileStats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
httpBody, readErr := ioutil.ReadAll(httpResponse.Body)
Expect(readErr).ToNot(HaveOccurred())
Expect(httpResponse.StatusCode).To(Equal(200))
Expect(httpBody).To(Equal([]byte("Some data")))
})
It("closes the underlying file", func() {
blobPath := "/var/vcap/micro_bosh/data/cache/123-456-789"
fs.WriteFileString(blobPath, "Some data")
httpResponse, err := httpClient.Get(serverURL + "/blobs/a5/123-456-789")
defer httpResponse.Body.Close()
fileStats, err := fs.FindFileStats(blobPath)
Expect(err).ToNot(HaveOccurred())
Expect(fileStats.Open).To(BeFalse())
})
Context("when incorrect http method is used", func() {
It("returns a 404", func() {
postBody := `{"method":"ping","arguments":["foo","bar"], "reply_to": "reply to me!"}`
postPayload := strings.NewReader(postBody)
httpResponse, err := httpClient.Post(serverURL+"/blobs/123", "application/json", postPayload)
Expect(err).ToNot(HaveOccurred())
defer httpResponse.Body.Close()
Expect(httpResponse.StatusCode).To(Equal(404))