public async Task CreateChannels_Succeeds() { string language = RpcWorkerConstants.JavaLanguageWorkerName; IRpcWorkerChannel javaWorkerChannel = CreateTestChannel(language); var initializedChannel = await _rpcWorkerChannelManager.GetChannelAsync(language); IRpcWorkerChannel javaWorkerChannel2 = CreateTestChannel(RpcWorkerConstants.JavaLanguageWorkerName); Assert.NotNull(initializedChannel); Assert.Equal(javaWorkerChannel.Id, initializedChannel.Id); Assert.Equal(_rpcWorkerChannelManager.GetChannels(RpcWorkerConstants.JavaLanguageWorkerName).Count(), 2); }
public async Task ShutdownStandByChannels_Succeeds() { var testMetricsLogger = new TestMetricsLogger(); _testEnvironment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName, RpcWorkerConstants.JavaLanguageWorkerName); _rpcWorkerChannelManager = new WebHostRpcWorkerChannelManager(_eventManager, _testEnvironment, _loggerFactory, _rpcWorkerChannelFactory, _optionsMonitor, testMetricsLogger); IRpcWorkerChannel javaWorkerChannel = CreateTestChannel(RpcWorkerConstants.JavaLanguageWorkerName); IRpcWorkerChannel nodeWorkerChannel = CreateTestChannel(RpcWorkerConstants.NodeLanguageWorkerName); _rpcWorkerChannelManager.ScheduleShutdownStandbyChannels(); Assert.True(AreRequiredMetricsEmitted(testMetricsLogger)); var initializedChannel = await _rpcWorkerChannelManager.GetChannelAsync(RpcWorkerConstants.NodeLanguageWorkerName); Assert.Null(initializedChannel); Assert.Null(_rpcWorkerChannelManager.GetChannels(RpcWorkerConstants.NodeLanguageWorkerName)); initializedChannel = await _rpcWorkerChannelManager.GetChannelAsync(RpcWorkerConstants.JavaLanguageWorkerName); Assert.NotNull(initializedChannel); Assert.Equal(javaWorkerChannel.Id, initializedChannel.Id); }