public void ReadFunctionMetadata_With_Retry_Succeeds()
        {
            string functionsPath = Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\sample\noderetry");

            _scriptApplicationHostOptions.ScriptPath = functionsPath;
            var optionsMonitor    = TestHelpers.CreateOptionsMonitor(_scriptApplicationHostOptions);
            var metadataProvider  = new FunctionMetadataProvider(optionsMonitor, NullLogger <FunctionMetadataProvider> .Instance, _testMetricsLogger);
            var workerConfigs     = TestHelpers.GetTestWorkerConfigs();
            var functionMetadatas = metadataProvider.GetFunctionMetadata(workerConfigs, false);

            Assert.Equal(2, functionMetadatas.Length);

            var functionMetadataWithRetry = functionMetadatas.Where(f => f.Name.Contains("HttpTrigger-RetryFunctionJson", StringComparison.OrdinalIgnoreCase));

            Assert.Single(functionMetadataWithRetry);
            var retry = functionMetadataWithRetry.FirstOrDefault().Retry;

            Assert.NotNull(retry);
            Assert.Equal(RetryStrategy.FixedDelay, retry.Strategy);
            Assert.Equal(4, retry.MaxRetryCount);
            Assert.Equal(TimeSpan.Parse("00:00:03"), retry.DelayInterval);

            var functionMetadata = functionMetadatas.Where(f => !f.Name.Contains("HttpTrigger-RetryFunctionJson", StringComparison.OrdinalIgnoreCase));

            Assert.Single(functionMetadataWithRetry);
            Assert.Null(functionMetadata.FirstOrDefault().Retry);
        }
        public void ReadFunctionMetadata_Succeeds()
        {
            string functionsPath = Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\sample\node");

            _scriptApplicationHostOptions.ScriptPath = functionsPath;
            var optionsMonitor   = TestHelpers.CreateOptionsMonitor(_scriptApplicationHostOptions);
            var metadataProvider = new FunctionMetadataProvider(optionsMonitor, new OptionsWrapper <LanguageWorkerOptions>(_languageWorkerOptions), NullLogger <FunctionMetadataProvider> .Instance, _testMetricsLogger);

            Assert.Equal(17, metadataProvider.GetFunctionMetadata(false).Length);
            Assert.True(AreRequiredMetricsEmitted(_testMetricsLogger));
        }
        public void ReadFunctionMetadata_Succeeds()
        {
            string functionsPath = Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\sample\node");
            var    scriptApplicationHostOptions = new ScriptApplicationHostOptions()
            {
                ScriptPath = functionsPath
            };

            var optionsMonitor = TestHelpers.CreateOptionsMonitor(scriptApplicationHostOptions);
            var workerOptions  = new LanguageWorkerOptions
            {
                WorkerConfigs = TestHelpers.GetTestWorkerConfigs()
            };

            var metadataProvider = new FunctionMetadataProvider(optionsMonitor, new OptionsWrapper <LanguageWorkerOptions>(workerOptions), NullLogger <FunctionMetadataProvider> .Instance);

            Assert.Equal(17, metadataProvider.GetFunctionMetadata(false).Length);
        }