public async Task StartWorkerProcessAsync_Invoked() { var initTask = _workerChannel.StartWorkerProcessAsync(); _testFunctionRpcService.PublishStartStreamEvent(_workerId); _testFunctionRpcService.PublishWorkerInitResponseEvent(); await initTask; _mockrpcWorkerProcess.Verify(m => m.StartProcessAsync(), Times.Once); }
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()); }
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()); }