package benchmark_bbs_test

import (
	"github.com/cloudfoundry-incubator/bbs/db/etcd"
	"github.com/cloudfoundry-incubator/benchmark-bbs/reporter"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

const (
	ConvergenceGathering = "ConvergenceGathering"
)

var BenchmarkConvergenceGathering = func(numTrials int) {
	Describe("Gathering", func() {
		Measure("data for convergence", func(b Benchmarker) {
			guids := map[string]struct{}{}

			b.Time("BBS' internal gathering of LRPs", func() {
				actuals, err := etcdDB.GatherActualLRPs(logger, guids, &etcd.LRPMetricCounter{})
				Expect(err).NotTo(HaveOccurred())
				Expect(len(actuals)).To(BeNumerically("~", expectedLRPCount, expectedLRPTolerance))

				desireds, err := etcdDB.GatherDesiredLRPs(logger, guids, &etcd.LRPMetricCounter{})
				Expect(err).NotTo(HaveOccurred())
				Expect(len(desireds)).To(BeNumerically("~", expectedLRPCount, expectedLRPTolerance))
			}, reporter.ReporterInfo{
				MetricName: ConvergenceGathering,
			})
		}, numTrials)
	})
}

package benchmark_bbs_test

import (
	"github.com/cloudfoundry-incubator/bbs/db/etcd"
	"github.com/cloudfoundry-incubator/benchmark-bbs/reporter"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

const (
	ConvergenceGathering = "ConvergenceGathering"
)

var BenchmarkConvergenceGathering = func(numTrials int) {
	Describe("Gathering", func() {
		Measure("data for convergence", func(b Benchmarker) {
			guids := map[string]struct{}{}

			b.Time("BBS' internal gathering of LRPs", func() {
				actuals, err := etcdDB.GatherActualLRPs(logger, guids, &etcd.LRPMetricCounter{})
				Expect(err).NotTo(HaveOccurred())
				Expect(len(actuals)).To(BeNumerically("~", expectedLRPCount, expectedLRPTolerance))

				desireds, err := etcdDB.GatherAndPruneDesiredLRPs(logger, guids, &etcd.LRPMetricCounter{})
				Expect(err).NotTo(HaveOccurred())
				Expect(len(desireds)).To(BeNumerically("~", expectedLRPCount, expectedLRPTolerance))
			}, reporter.ReporterInfo{
				MetricName: ConvergenceGathering,
			})
		}, numTrials)
	})
}

Use new lrp convergence method
Use new lrp convergence method

* GatherDesiredLRPs -> GatherAndPruneDesiredLRPs

Signed-off-by: James Myers <44cbd4b2784f900a6fede6279d0b7fdcbfaa89f5@pivotal.io>
