public void SendLoadRequests_PublishesOutboundEvents() { _metricsLogger.ClearCollections(); _workerChannel.SetupFunctionInvocationBuffers(GetTestFunctionsList("node")); _workerChannel.SendFunctionLoadRequests(); var traces = _logger.GetLogMessages(); var functionLoadLogs = traces.Where(m => string.Equals(m.FormattedMessage, _expectedLogMsg)); AreExpectedMetricsGenerated(); Assert.True(functionLoadLogs.Count() == 2); }
public async Task Drain_Verify() { var resultSource = new TaskCompletionSource <ScriptInvocationResult>(); Guid invocationId = Guid.NewGuid(); RpcWorkerChannel channel = new RpcWorkerChannel( _workerId, _eventManager, _testWorkerConfig, _mockrpcWorkerProcess.Object, _logger, _metricsLogger, 0, _testEnvironment, _hostOptionsMonitor); channel.SetupFunctionInvocationBuffers(GetTestFunctionsList("node")); ScriptInvocationContext scriptInvocationContext = GetTestScriptInvocationContext(invocationId, resultSource); await channel.SendInvocationRequest(scriptInvocationContext); Task result = channel.DrainInvocationsAsync(); Assert.NotEqual(result.Status, TaskStatus.RanToCompletion); channel.InvokeResponse(new InvocationResponse { InvocationId = invocationId.ToString(), Result = new StatusResult { Status = StatusResult.Types.Status.Success }, }); await result; Assert.Equal(result.Status, TaskStatus.RanToCompletion); }
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()); }