Beispiel #1
0
        public async Task StartWorkerProcessAsync_Invoked()
        {
            var initTask = _workerChannel.StartWorkerProcessAsync();

            _testFunctionRpcService.PublishStartStreamEvent(_workerId);
            _testFunctionRpcService.PublishWorkerInitResponseEvent();
            await initTask;

            _mockrpcWorkerProcess.Verify(m => m.StartProcessAsync(), Times.Once);
        }
Beispiel #2
0
        public async Task StartWorkerProcessAsync_Invoked_SetupFunctionBuffers_Verify_ReadyForInvocation()
        {
            var initTask = _workerChannel.StartWorkerProcessAsync();

            _testFunctionRpcService.PublishStartStreamEvent(_workerId);
            _testFunctionRpcService.PublishWorkerInitResponseEvent();
            await initTask;

            _mockrpcWorkerProcess.Verify(m => m.StartProcessAsync(), Times.Once);
            Assert.False(_workerChannel.IsChannelReadyForInvocations());
            _workerChannel.SetupFunctionInvocationBuffers(GetTestFunctionsList("node"));
            Assert.True(_workerChannel.IsChannelReadyForInvocations());
        }
Beispiel #3
0
        public async Task StartWorkerProcessAsync_WorkerProcess_Throws()
        {
            Mock <IWorkerProcess> mockrpcWorkerProcessThatThrows = new Mock <IWorkerProcess>();

            mockrpcWorkerProcessThatThrows.Setup(m => m.StartProcessAsync()).Throws <FileNotFoundException>();

            _workerChannel = new RpcWorkerChannel(
                _workerId,
                _scriptRootPath,
                _eventManager,
                _testWorkerConfig,
                mockrpcWorkerProcessThatThrows.Object,
                _logger,
                _metricsLogger,
                0);
            await Assert.ThrowsAsync <FileNotFoundException>(async() => await _workerChannel.StartWorkerProcessAsync());
        }