Exemplo n.º 1
0
        public IObservable <bfgWorker> SpawnTestWorker(string[] tags = null)
        {
            var instanceId = _workerCluster.Workflow.Workers.Count + 1;

            "Spawning worker".LogDebug(instanceId);

            //$"Streaming logs".LogDebug();
            //rxnManager.Publish(new StreamLogs(TimeSpan.FromMinutes(60))).Until();

            $"Starting worker".LogDebug();

            var testWorker = new bfgWorker(
                $"{ClientId}/TestWorker#{instanceId}",
                "local",
                tags ?? theBfg.Args.Where(w => w.StartsWith("#")).ToArray(),
                _appServiceRegistry, _serviceDiscovery,
                _zipService, _appStatus,
                _eventManager, _appUpdates,
                _appStatusCfg,
                _resolver.Resolve <Func <ITestArena[]> >()
                );

            _workerCluster.Process(new WorkerDiscovered <StartUnitTest, UnitTestResult>()
            {
                Worker = testWorker
            })
            .SelectMany(e => _eventManager.Publish(e)).Until();

            return(StartDiscoveringTestsIf(_cfg, testWorker).Select(_ => testWorker));
        }
Exemplo n.º 2
0
        private IObservable <Unit> StartDiscoveringTestsIf(IObservable <StartUnitTest[]> cfg, bfgWorker testWorker)
        {
            return(cfg.Take(1).Select(tests =>
            {
                //todo: cleanup this code and decide
                if (!tests.AnyItems() || tests[0].AppStatusUrl.IsNullOrWhitespace() && !Directory.Exists(tests[0].UseAppVersion))
                {
                    testWorker.DiscoverAndDoWork();
                }

                return new Unit();
            }));
        }