ghttp.CombineHandlers( ghttp.VerifyRequest("GET", fmt.Sprintf("/api/common/nodes/%s", nodes[1].ID)), ghttp.RespondWith(http.StatusOK, node1HttpResponse), ), ) node, err := randomSelectAvailableNode(cpiConfig, nodes, allowFilter) Expect(err).ToNot(HaveOccurred()) Expect(node.ID).To(Equal("55e79ea54e66816f6152fff9")) }) }) }) Describe("retrying node reservation", func() { It("return a node if selection is successful", func() { cpiConfig.MaxReserveNodeAttempts = 3 nodeID, err := TryReservation( cpiConfig, "", func(config.Cpi, string, Filter) (rackhdapi.Node, error) { return rackhdapi.Node{ID: "node-1234"}, nil }, func(config.Cpi, rackhdapi.Node) error { return nil }, ) Expect(err).ToNot(HaveOccurred()) Expect(nodeID).To(Equal("node-1234")) }) It("returns an error if selection continually fails", func() { cpiConfig.MaxReserveNodeAttempts = 3 nodeID, err := TryReservation( cpiConfig, "",