コード例 #1
0
        public void SendInvocationRequest_PublishesOutboundEvent()
        {
            ScriptInvocationContext scriptInvocationContext = GetTestScriptInvocationContext(Guid.NewGuid(), null);

            _workerChannel.SendInvocationRequest(scriptInvocationContext);
            var traces = _logger.GetLogMessages();

            Assert.True(traces.Any(m => string.Equals(m.FormattedMessage, _expectedLogMsg)));
        }
コード例 #2
0
        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);
        }