當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Server.Close方法代碼示例

本文整理匯總了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"))
開發者ID:vmware,項目名稱:photon-controller-go-sdk,代碼行數:30,代碼來源:disks_test.go

示例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))
		})
	})
開發者ID:vmware,項目名稱:photon-controller-go-sdk,代碼行數:30,代碼來源:auth_test.go


注:本文中的github.com/vmware/photon-controller-go-sdk/photon/internal/mocks.Server.Close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。