本文整理匯總了Golang中github.com/vmware/photon-controller-go-sdk/photon/internal/mocks.Server.Close方法的典型用法代碼示例。如果您正苦於以下問題:Golang Server.Close方法的具體用法?Golang Server.Close怎麽用?Golang Server.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/vmware/photon-controller-go-sdk/photon/internal/mocks.Server
的用法示例。
在下文中一共展示了Server.Close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
resName = createResTicket(server, client, tenantID)
projID = createProject(server, client, tenantID, resName)
flavorName, flavorID = createFlavor(server, client)
diskSpec = &DiskCreateSpec{
Flavor: flavorName,
Kind: "persistent-disk",
CapacityGB: 2,
Name: randomString(10, "go-sdk-disk-"),
}
})
AfterEach(func() {
cleanDisks(client, projID)
cleanFlavors(client)
cleanTenants(client)
server.Close()
})
Describe("CreateAndDeleteDisk", func() {
It("Disk create and delete succeeds", func() {
mockTask := createMockTask("CREATE_DISK", "COMPLETED")
server.SetResponseJson(200, mockTask)
task, err := client.Projects.CreateDisk(projID, diskSpec)
task, err = client.Tasks.Wait(task.ID)
GinkgoT().Log(err)
Expect(err).Should(BeNil())
Expect(task).ShouldNot(BeNil())
Expect(task.Operation).Should(Equal("CREATE_DISK"))
Expect(task.State).Should(Equal("COMPLETED"))
示例2:
server *mocks.Server
authServer *mocks.Server
client *Client
)
BeforeEach(func() {
if isIntegrationTest() {
Skip("Skipping auth test as we don't know if auth is on or off.")
}
server, client = testSetup()
authServer = mocks.NewTlsTestServer()
})
AfterEach(func() {
server.Close()
authServer.Close()
})
Describe("GetAuth", func() {
It("returns auth info", func() {
expected := createMockAuthInfo(nil)
server.SetResponseJson(200, expected)
info, err := client.Auth.Get()
fmt.Fprintf(GinkgoWriter, "Got auth info: %+v\n", info)
Expect(err).Should(BeNil())
Expect(info).Should(BeEquivalentTo(expected))
})
})