Exemplo n.º 1
0
        public async Task RpcInitializationService_Initializes_WorkerRuntime_NotSet_NoPlaceholder()
        {
            var testEnvironment = new TestEnvironment();

            _rpcInitializationService = new RpcInitializationService(_optionsMonitor, testEnvironment, _testRpcServer, _mockLanguageWorkerChannelManager.Object, _loggerFactory);
            _rpcInitializationService.AddSupportedRuntime(LanguageWorkerConstants.NodeLanguageWorkerName);
            await _rpcInitializationService.StartAsync(CancellationToken.None);

            _mockLanguageWorkerChannelManager.Verify(m => m.InitializeChannelAsync(LanguageWorkerConstants.JavaLanguageWorkerName), Times.Never);
            _mockLanguageWorkerChannelManager.Verify(m => m.InitializeChannelAsync(LanguageWorkerConstants.NodeLanguageWorkerName), Times.Never);
            Assert.Contains("testserver", _testRpcServer.Uri.ToString());
        }
Exemplo n.º 2
0
        public async Task RpcInitializationService_Initializes_WorkerRuntime_Set()
        {
            IRpcServer testRpcServer   = new TestRpcServer();
            var        mockEnvironment = new Mock <IEnvironment>();

            mockEnvironment.Setup(p => p.GetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName)).Returns(LanguageWorkerConstants.NodeLanguageWorkerName);

            _rpcInitializationService = new RpcInitializationService(_optionsMonitor, mockEnvironment.Object, testRpcServer, _mockLanguageWorkerChannelManager.Object, _loggerFactory);
            _rpcInitializationService.AddSupportedRuntime(LanguageWorkerConstants.NodeLanguageWorkerName);
            await _rpcInitializationService.StartAsync(CancellationToken.None);

            _mockLanguageWorkerChannelManager.Verify(m => m.InitializeChannelAsync(LanguageWorkerConstants.NodeLanguageWorkerName), Times.Once);
            Assert.Contains("testserver", testRpcServer.Uri.ToString());
        }