public IObservable <UnitTestResult> DoWork(StartUnitTest work) { //setup the command to call back to us //and setup the client to run the downloaded version //instead of the original target existing on the machine (local fire) work.AppStatusUrl = $"http://{RxnApp.GetIpAddress()}:888"; var workDll = new FileInfo(work.Dll); work.Dll = Path.Combine(theBfg.GetTestSuiteDir(work), workDll.Name).AsCrossPlatformPath(); return(WhenUpdateExists(work) .SelectMany(u => { //send the command to the worker to run the test _appCmds.Add(work.AsQuestion(Route)); //wait for the test response return _repsonseChannel.CreateSubscription <UnitTestResult>() .Where(c => c.InResponseTo == work.Id) .FirstOrDefaultAsync() .FinallyR(() => { _isBusy.OnNext(false); }); })); }
public static IDisposable StartTestArena(string[] args, IObservable <StartUnitTest[]> testCfg, bfgCluster cluster, bfgWorkerManager workerManager, IRxnManager <IRxn> toFireOn, IAppServiceDiscovery discovery) { "Starting up TestArena".LogDebug(); if (_started.HasValue) { _started = DateTime.Now; } var stopAdvertising = bfgTestArenaApi.AdvertiseForWorkers(discovery, "all", $"http://{RxnApp.GetIpAddress()}:888"); theBfg.Use(cluster, workerManager); var stopWorkers = Disposable.Empty; if (args.Any(a => a.BasicallyEquals("fire"))) { stopWorkers = theBfg.StartTestArenaWorkers(args, testCfg).Until(); } var stopFiring = StartFiringWorkflow(args, testCfg, toFireOn); return(new CompositeDisposable(stopAdvertising, stopWorkers, stopFiring)); }