コード例 #1
0
ファイル: report.go プロジェクト: layer-x/pluggable-auction
func (r *Report) IsAuctionedInstance(inst rep.LRP) bool {
	if r.auctionedInstancesByInstGuid == nil {
		r.auctionedInstancesByInstGuid = map[string]bool{}
		for _, result := range r.AuctionResults.SuccessfulLRPs {
			r.auctionedInstancesByInstGuid[result.Identifier()] = true
		}
	}

	return r.auctionedInstancesByInstGuid[inst.Identifier()]
}
コード例 #2
0
				)
				task := rep.NewTask("the-task-guid", "tests", rep.NewResource(2048, 1024, linuxRootFSURL))

				work = rep.Work{
					LRPs:  []rep.LRP{lrp},
					Tasks: []rep.Task{task},
				}
			})

			It("returns all work it was given", func() {
				Expect(cellRep.Perform(work)).To(Equal(work))
			})
		})

		Describe("performing starts", func() {
			var lrpAuctionOne, lrpAuctionTwo rep.LRP
			var securityRule *models.SecurityGroupRule
			var expectedGuidOne = "instance-guid-1"
			var expectedGuidTwo = "instance-guid-2"
			var expectedIndexOne int32 = 1
			var expectedIndexTwo int32 = 2
			const expectedIndexOneString = "1"
			const expectedIndexTwoString = "2"

			BeforeEach(func() {
				guidChan := make(chan string, 2)
				guidChan <- expectedGuidOne
				guidChan <- expectedGuidTwo

				fakeGenerateContainerGuid = func() (string, error) {
					return <-guidChan, nil