Beispiel #1
0
		var err error
		conn, err = redis.Connect("", 63798, "p4ssw0rd")
		Ω(err).ShouldNot(HaveOccurred())
		workloadCtx = context.New()
	})

	AfterEach(func() {
		StopRedis()
	})

	Describe("When a single experiment is provided", func() {
		Context("When no slaves are running", func() {
			It("Times out after a specified time", func() {
				worker := NewRedisWorkerWithTimeout(conn, 1)
				workloadCtx.PutInt("iterationIndex", 0)
				worker.AddWorkloadStep(workloads.Step("timesout", func() error { time.Sleep(10 * time.Second); return nil }, ""))
				result := make(chan error)
				go func() {
					result <- worker.Time("timesout", workloadCtx).Error
				}()
				Eventually(result, 2).Should(Receive())
			})
		})

		Context("When a slave is running", func() {
			var (
				slave                       io.Closer
				delegate                    *LocalWorker
				wasCalledWithWorkerIndex    int
				wasCalledWithWorkerUsername string
				wasCalledWithRandomKey      string
Beispiel #2
0
func (dummyDescriberWithThreeWorkloads) DescribeWorkloads(worker workloads.WorkloadAdder) {
	worker.AddWorkloadStep(workloads.Step("a", nil, "desc"))
	worker.AddWorkloadStep(workloads.Step("b", nil, "desc"))
	worker.AddWorkloadStep(workloads.Step("c", nil, "desc"))
}
Beispiel #3
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Cmdline", func() {
	var (
		flags config.Config
		args  []string
		lab   *dummyLab
		err   error
	)

	BeforeEach(func() {
		WithConfiguredWorkerAndSlaves = func(fn func(Worker benchmarker.Worker) error) error {
			worker := benchmarker.NewLocalWorker()
			worker.AddWorkloadStep(workloads.Step("login", nil, "description"))
			worker.AddWorkloadStep(workloads.Step("push", nil, "description"))
			worker.AddWorkloadStep(workloads.Step("cf:push", nil, "description"))
			return fn(worker)
		}

		LaboratoryFactory = func(store laboratory.Store) (newLab laboratory.Laboratory) {
			lab = &dummyLab{}
			newLab = lab
			return
		}
	})

	JustBeforeEach(func() {
		flags = config.NewConfig()
		InitCommandLineFlags(flags)