Beispiel #1
0
        public static IObservable <Unit> ReloadWithTestWorker(params string[] args)
        {
            return(Rxn.Create <Unit>(o =>
            {
                var apiName = args.Skip(1).FirstOrDefault();
                var testHostUrl = GetTestarenaUrlFromArgs(args);
                theBfg.Args = args;


                RxnExtensions.DeserialiseImpl = (t, json) => JsonExtensions.FromJson(json, t);
                RxnExtensions.SerialiseImpl = (json) => JsonExtensions.ToJson(json);

                var cfg = RxnAppCfg.Detect(args);
                //var appStore = new CurrentDirectoryAppUpdateStore();
                //var clusterHost = OutOfProcessFactory.CreateClusterHost(args, appStore, cfg);

                return theBfgDef.TestWorker(apiName, testHostUrl, RxnApp.SpareReator(testHostUrl)).ToRxns()
                .Named(new bfgAppInfo("bfgWorker"))
                .OnHost(new ConsoleHostedApp(), cfg)
                .SelectMany(h => h.Run().Do(app =>
                {
                    theBfg.IsReady.OnNext(app);
                }))
                .Select(app =>
                {
                    return new Unit();
                })
                .Subscribe(o);
            }));
        }
Beispiel #2
0
        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); });
            }));
        }
Beispiel #3
0
        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));
        }