// runScenarioTest runs a test with the given number of orders func runScenarioTest(assert *asserts.Asserts, param scenarioParam) { applog.Infof(param.String()) monitoring.Reset() // Prepare test. done := make(chan bool) provider := config.NewMapConfigurationProvider() config := config.New(provider) config.Set("backend", "single") assert.Nil(ebus.Init(config), "single node backend started") StartShopAgent() StartWarehouseAgent() StartManufacturerAgent() StartDeliveryAgent() StartWaitAgent(done) // Run orders. for on := 0; on < param.Orders; on++ { order := generateOrder(on) err := ebus.Emit(order, "OrderReceived") assert.Nil(err, "order emitted") } select { case <-done: applog.Infof("order processing done") case <-time.After(param.Timeout): assert.Fail("timeout during wait for processed orders") } // Finalize test. err := ebus.Stop() assert.Nil(err, "stopped the bus") time.Sleep(time.Second) monitoring.MeasuringPointsPrintAll() }